note 39270 added to language.variables.external
| From: | jim at jamesdavis dot it | Date: | Thu, 22 Jan 2004 16:59:20 +0000 |
| Subject: | note 39270 added to language.variables.external | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64026@lists.php.net to get a copy of this message | ||
How to pass a numerically indexed array.
This is the part inside the form. Notice that the name is not 'english[$r]' which you
would normally write, but 'english[]'. PHP adds the index when it receives the post and it
starts at 0.
<?php
for ($r=0; $r <= count($english)-1; $r++){
echo "<TEXTAREA
NAME='english[]',>".$english[$r]."</TEXTAREA>
}
?>
<?php
And this will get it out at the other end
function retrieve_english(){
for ($r=0; $r <= count($_POST['english'])-1; $r++){
echo $_POST['english'][$r]."<BR>";
}
}
?>
Keys are useful but so are numerical indices!
Cheers everyone
----
Manual Page -- http://www.php.net/manual/en/language.variables.external.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39270
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39270&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39270&report=yes
Search -- http://master.php.net/manage/user-notes.php