RE: [PHP] array insert help

From: Date: Sat, 22 Mar 2003 23:09:01 +0000
Subject: RE: [PHP] array insert help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-140715@lists.php.net to get a copy of this message
At 22:24 22.03.2003, Jason Dulberg said: --------------------[snip]-------------------- >Thanks for your help... > >I tried the code as you suggested however when I attempted to echo the >variables for testing but nothing showed. > >for($i = 0; $i <= 1; ++$i) { > echo "<p>address".$_POST['address']['address'][$i]; > echo "<br>city".$_POST['address']['city'][$i]; >} --------------------[snip]-------------------- Jason, I tried the following and it worked: <form method="post"> <b>Home Address:</b><br /> <input type="text" name="address[address][0]" value="<?php echo $_POST['address']['address'][0]; ?>"> <input type="text" name="address[city][0]" value="<?php echo $_POST['address']['city'][0]; ?>"> <br /> <b>Work Address:</b><br /> <input type="text" name="address[address][1]" value="<?php echo $_POST['address']['address'][1]; ?>"> <input type="text" name="address[city][1]" value="<?php echo $_POST['address']['city'][1]; ?>"> <br /> <input type="submit"> </form> <?php for($i = 0; $i <= 1; ++$i) { echo "<p>address $i: ".$_POST['address']['address'][$i]; echo "<br>city $i: ".$_POST['address']['city'][$i]; } -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#140715) next »