Re: $_GET of array variables

From: Date: Thu, 06 Jan 2005 00:05:29 +0000
Subject: Re: $_GET of array variables
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-37989@lists.php.net to get a copy of this message
Thank you very much for all the ideas. "Printing it out" and the "print_r( $_GET )" of all the incoming variables did it, along with some caffeine. In case any future people are interested, the array results from an HTML form multiple select box like: <select name='blight[]' multiple=\"multiple\"> <option value='unknown'>unknown</option> <option value='on trunk'>on trunk</option> etc. </select> do in fact come nicely back in PHP 4 in at least one way: $blight=$_GET['blight']; (so I didn't need to refer to the specific array keys at all in this part; $blight is an array) then I entered it into my linking MySQL table as: foreach ($blight as $blightid) { $queryInsertBlightLink= "INSERT INTO blightlink (treeid, blightid) VALUES (\"$treeid\",\"$blightid\")"; $resultInsertBlightLink = mysql_query($queryInsertBlightLink); } Thanks again! "Yvonne Federowicz" <Yvonne_Federowicz@brown.edu> wrote in message news:20050105174304.21252.qmail@pb1.pair.com... > Hello, > > I am new to PHP 4, and have not been able to find the answer to this online > or through experimentation yet. > > I have array variables from html forms that I am passing back into the php > in order to enter into MySQL. I have had no trouble with simple variables > using > > $_GET['simplevariable'] but am not having much luck with anything like: > > $_GET["arrayvariable$a"] (1-dimensional array) or > $_GET["arrayvariable$a$b"] (2-dimensional array) > > (I've tried several other odd syntaxes such as > $_GET["arrayvariable[$a][$b]"]. Also it's not an \" situation.) > > In PHP 3 one can just use the array variables. > Hopefully a simple syntax thing... Thank you for any ideas! > > Yvonne

« previous php.db (#37989) next »