note 34155 added to faq.html
| From: | nick at rack1 dot php dot net | Date: | Thu, 17 Jul 2003 08:34:40 +0000 |
| Subject: | note 34155 added to faq.html | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-52256@lists.php.net to get a copy of this message | ||
Nested arrays are handled properly by php, when posted from a html form.
Quoting keys in associative arrays in a html form results in different results than if you quote an
associative key in php code.
i.e. try this:
<?php
$var2["asdf"] = "asdlfjasdf";
if ($_GET['action'] == 'do')
{
echo "<pre>\nPosted var";
print_r($_POST['var']);
echo "php defined var";
print_r($var2);
echo "\n</pre>\n";
}
?>
<html>
<body>
<form action='?action=do' method='post'>
<input name='var[]' /><br>
<input name='var[]' /><br>
<input name='var["asdf"][]' /><br>
<input name='var["asdf"]["asdf"]' /><br>
<input type='submit' />
</form>
</body>
</html>
the posted var with the double quoted associative keys are interpreted differently than the
php-defined associative keys (which are also quoted)
----
Manual Page -- http://www.php.net/manual/en/faq.html.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34155
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34155&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34155&report=yes