note 18722 added to language.types.array

From: Date: Fri, 01 Feb 2002 22:26:42 +0000
Subject: note 18722 added to language.types.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-26144@lists.php.net to get a copy of this message
Watch out when passing associative arrays through forms. Don't put quotes in the html to distinguish a string php will pick them up as a literal part of the string. Just use single quotes in the actual php when referencing the value. Please comment on this as im not 100% sure its right. form action=t.php method=post> <input type=hidden name=test[0][test1] value=moo1> <input type=hidden name=test[0][test2] value=moo2> <input type=hidden name=test[0][test3] value=moo3> <input type=submit value=go> </form> <pre> <? print_r($test); print "Test: " . $test[0]['test1'] . "<br>"; print "Test: " . $test[0]['test2'] . "<br>"; print "Test: " . $test[1]['test3'] . "<br>"; ?> -- http://www.php.net/manual/en/language.types.array.php http://master.php.net/manage/user-notes.php?action=edit+18722 http://master.php.net/manage/user-notes.php?action=delete+18722 http://master.php.net/manage/user-notes.php?action=reject+18722

« previous php.notes (#26144) next »