Re: Passing PHP Arrays as type "hidden" in a HTML Form
| From: | Sander Roobol | Date: | Tue, 12 Mar 2002 19:45:52 +0000 |
| Subject: | Re: Passing PHP Arrays as type "hidden" in a HTML Form | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-81093@lists.php.net to get a copy of this message | ||
It might be a bit late, but PHP-DEV is for developing PHP, not for developing WITH PHP. Use php-general@lists.php.net for support questions.
Sander
On 2002.03.12 20:37 Surya Saraff wrote:
Hi, actually, I encountered serialize(), urlencode() AND IT WORKS!!! first you serialize(), then urlencode then urlencode() and unserialize() to get back the original array. thanks surya --- "Hunter, Ray" <rhunter@enterasys.com> wrote: Try using the $_POST function for getting the variable... echo "<input type=\"hidden\" name=\"oldStatus\" value=\"$status[]\"></input>"; $oldStatus = $_POST["oldStatus"]; Thank you, Ray Hunter Firmware Engineer ENTERASYS NETWORKS -----Original Message----- From: Surya Saraff [mailto:surya_saraff@yahoo.com] Sent: Tuesday, March 12, 2002 11:42 AM To: rhunter@enterasys.com Subject: RE: [PHP-DEV] Passing PHP Arrays as type "hidden" in a HTML Form Dear Ray, when I try echo "<input type=\"hidden\" name=\"oldStatus\" value=\"$status[]></input>"; I get: Parse error: parse error, expecting `T_STRING' orT_VARIABLE' orT_NUM_STRING' And when I remove [], and in the next page I do $oldStatus = $HTTP_POST_VARS["oldStatus"]; echo $oldStatus[1]; //i get "r" Sorry, to bother you again. But, if u have any other suggestions please let me know thanks surya --- "Hunter, Ray" <rhunter@enterasys.com> wrote:Do it like this: $status = array( 0, 1 ) echo "<input type=\"hidden\" name=\"oldStatus\" value=\"$status[]></input>"; Then access the array through the name...oldStatushere... Thank you, Ray Hunter Firmware Engineer ENTERASYS NETWORKS -----Original Message----- From: Surya Saraff [mailto:surya_saraff@yahoo.com] Sent: Tuesday, March 12, 2002 10:07 AM To: rhunter@enterasys.com Cc: php-dev@lists.php.net Subject: RE: [PHP-DEV] Passing PHP Arrays as type "hidden" in a HTML Form Hi, I had tried it, it doesnt work. in t1.php: echo $a; //give me "Array" echo $a[1] //gives me "A" echo $a[2] //gives me "r" and so on... $a just gets the value "Array", but not the elements. Any suggestions? thanks, surya --- "Hunter, Ray" <rhunter@enterasys.com> wrote:[mailto:surya_saraff@yahoo.com]Yes that is possible... Thank you, Ray Hunter Firmware Engineer ENTERASYS NETWORKS -----Original Message----- From: Surya SaraffandSent: Tuesday, March 12, 2002 9:48 AM To: php-dev@lists.php.net Subject: [PHP-DEV] Passing PHP Arrays as type "hidden" in a HTML Form Hi, I am trying to pass an array with hidden typeofaccess it by value. for eg: IN t.php <?php $a = array(1, 2, 3, 4, 5); print ("<form action =\"t1.php\" method = post=$a");print("<input type = hidden name =\"_a\" valuesince");print("<input type =submit value=submit>"); print("</form>"); ?> IN t1.php (the page i am calling) <?php $a = $HTTP_POST_VARS["_a"]; echo $a[1]; //i want "2" to be printed here,$a[0]=1, $a[1] =2 --- is it possible? ?> Any suggestions as to how can I pass the valuehelp!the array through an HTML form, would be a great__________________________________________________Thanks, Surya<http://www.php.net/>Do You Yahoo!? Try FREE Yahoo! Mail - the world's greatest free email! http://mail.yahoo.com/ -- PHP Development Mailing List__________________________________________________ Do You Yahoo!? Try FREE Yahoo! Mail - the world's greatest free email! http://mail.yahoo.com/ __________________________________________________ Do You Yahoo!? Try FREE Yahoo! Mail - the world's greatest free email! http://mail.yahoo.com/ -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.phpTo unsubscribe, visit:http://www.php.net/unsub.php__________________________________________________ Do You Yahoo!? Try FREE Yahoo! Mail - the world's greatest free email! http://mail.yahoo.com/