Re: [PHP] Passing an array as a hidden variable
On Fri, 2007-05-11 at 21:53 -0700, Todd Cary wrote: > When I use the following syntax, the 2 dimensional array loses > it's contents. Can an array be passed this way? > > $attend_ary_save .'>'; ?> No! RTFM! http://www.php.net/manual/en/language.types.type-juggling.php Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing an array as a hidden variable
On Fri, May 11, 2007 11:53 pm, Todd Cary wrote: > When I use the following syntax, the 2 dimensional array loses > it's contents. Can an array be passed this way? > > $attend_ary_save .'>'; ?> No. You'll just get "Array" back. You can do a few things: $v1){ foreach($v1 as $k2 => $v2){ ?> Actually, you should wrap htmlentities() around each value being echo-ed out. Another option is to http://php.net/serialize the data before you send it to HTML, and then (duh) unserialize it when it comes back. Or, be REALLY smart, and use session_start() and just put the array in $_SESSION and don't send data back-n-forth over HTTP, which is A) expensive, and B) subject to user tampering, and C) inefficient. Actually, A and C technically depend on your bandwidth versus hard drive speed, or wherever you store you session data, so, in theory, it could be cheaper or more efficient to use HTTP... But I sure doubt it in any real world hardware setup. PS Just FYI, internally, PHP's session data is just serialized the same way you'd do it for HTTP. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing an array as a hidden variable
Check out the 1st code example : http://www.php-code-search.com/?q=how%20to%20pass%20an%20array%20from%20one berber -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Sunday, May 13, 2007 6:58 AM To: Todd Cary Cc: php-general@lists.php.net Subject: Re: [PHP] Passing an array as a hidden variable On Fri, May 11, 2007 11:53 pm, Todd Cary wrote: > When I use the following syntax, the 2 dimensional array loses it's > contents. Can an array be passed this way? > > $attend_ary_save .'>'; ?> No. You'll just get "Array" back. You can do a few things: $v1){ foreach($v1 as $k2 => $v2){ ?> Actually, you should wrap htmlentities() around each value being echo-ed out. Another option is to http://php.net/serialize the data before you send it to HTML, and then (duh) unserialize it when it comes back. Or, be REALLY smart, and use session_start() and just put the array in $_SESSION and don't send data back-n-forth over HTTP, which is A) expensive, and B) subject to user tampering, and C) inefficient. Actually, A and C technically depend on your bandwidth versus hard drive speed, or wherever you store you session data, so, in theory, it could be cheaper or more efficient to use HTTP... But I sure doubt it in any real world hardware setup. PS Just FYI, internally, PHP's session data is just serialized the same way you'd do it for HTTP. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php