Re: passing array as hidden field

From: Date: Wed, 24 Apr 2002 18:08:34 +0000
Subject: Re: passing array as hidden field
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-94428@lists.php.net to get a copy of this message
On Thursday 25 April 2002 02:02, Pushkar Pradhan wrote: > I want to pass a 1 dim. array through a form, I use the hidden field and > do as follows: > <form method=POST ACTION=\"updateHTML.php\"> > <input type=hidden name=layer[] value=\""; > foreach($layer as $lay) { > print "$lay "; > } > print "\"> > This generates the foll. source: > <form method=POST ACTION="updateHTML.php"> > <input type=hidden name=layer[] value="a b c d e f g h "> > where actually it should be $layer[] = "a", "b", "c", .... Actually you want the <input ...> inside the loop as well: foreach($layer as $lay) { print "<input type='hidden' name='layer[]' value='$lay'"; } -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Old age is always fifteen years old than I am. -- B. Baruch */

« previous php.general (#94428) next »