RE: [PHP] multple select forms... going to hit my head against a wall ..

From: Date: Tue, 23 Jan 2001 12:51:04 +0000
Subject: RE: [PHP] multple select forms... going to hit my head against a wall ..
Groups: php.general 
Request: Send a blank email to php-general+get-36184@lists.php.net to get a copy of this message
Sorry, my bad. I should have spotted the cunning way he used the word "array", really :-) Eyes closing. More coffee. <glug> aaaaaahaaaaaahhhhhhhrrrggggghhhhhhh Cheers Jon -----Original Message----- From: hsmith@twilyt.com [mailto:hsmith@twilyt.com] Sent: 23 January 2001 12:45 To: Jon Haworth Cc: 'php-general@lists.php.net' Subject: Re: [PHP] multple select forms... going to hit my head against a wall .. ummmm ... $select is an array .. so echo $select will just produce "array" .. On Tue, Jan 23, 2001 at 12:44:20PM -0000, Jon Haworth wrote: > Try either: > > ?> > <input type="hidden" name="select" value="<?php echo $select; > ?>" > <?php > > OR > > printf ("input type=\"hidden\" name=\"select\" > value=\"%s\">", > $select); > > > HTH > Jon > > > > -----Original Message----- > From: hsmith@twilyt.com [mailto:hsmith@twilyt.com] > Sent: 23 January 2001 12:27 > To: Adrian Murphy > Cc: PHP list > Subject: Re: [PHP] multple select forms... going to hit my head against > a wall .. > > > Having soved this .. thanks .. now for the next question .. *grin* > > I have the $select ... but I only use it on the next page .. heheh > so I'm trying the following .. > > <input type=\"hidden\" name=\"select\" value=\"$select\"> > > which of course doens't work .. nor does > > <input type=\"hidden\" name=\"select[]" value=\"$select\"> > > any idea on how to pass an array on in an input field in a form ? > > Henti > > > > On Tue, Jan 23, 2001 at 12:01:40PM -0000, Adrian Murphy wrote: > > hey, > > since u are slecting multiple options you'll have to use an array > > here's how.i u need explanation,feel free to mail me: > > > > <? > > if ($select==""){ > > print" > > <form method=\"post\" name=\"select\" > > action=\"test.php3\"> > > <SELECT MULTIPLE NAME=\"select[]\"> > > <Option VALUE=\"Chocolate\">Chocolate/Chocolate Chip > > <Option VALUE=\"Peanut\">Peanut Brittle/Vanilla > > <Option Selected VALUE=\"Cookie\">Cookie Batter > > <Option VALUE=\"Blueberry\">Vanilla/Blueberry > > <Option VALUE=\"Caramel\">Caramel Swirl > > <Option VALUE=\"Other\">Other... > > </select><br> > > <input type=\"submit\" name=\"send\" value=\"test\"> > > </form> > > "; > > > > }else{ > > > > ///count array > > $num = count($select); > > > > file://loop through array > > for($i = 0;$i <$num;$i++){ > > print $select[$i] . "<br>"; > > } > > } > > ?> > > ----- Original Message ----- > > From: <hsmith@twilyt.com> > > To: PHP list <php-general@lists.php.net> > > Sent: Tuesday, January 23, 2001 11:42 AM > > Subject: [PHP] multple select forms... going to hit my head against a wall > > .. > > > > > > > Hi all > > > > > > I'm having a slight little problem .. I can't seem to solve.. > > > > > > I have a multiple select form .. that i select mutiple options from and > > then it creates a variable called $select > > > now if I display $select .. I only get the last selected value .. here > > foloows test code.. > > > > > > <? > > > if ($select==""){ > > > print" > > > <form method=\"post\" name=\"select\" > > > action=\"test.php3\"> > > > <SELECT MULTIPLE NAME=\"select\"> > > > <Option VALUE=\"Chocolate\">Chocolate/Chocolate Chip > > > <Option VALUE=\"Peanut\">Peanut Brittle/Vanilla > > > <Option Selected VALUE=\"Cookie\">Cookie Batter > > > <Option VALUE=\"Blueberry\">Vanilla/Blueberry > > > <Option VALUE=\"Caramel\">Caramel Swirl > > > <Option VALUE=\"Other\">Other... > > > </select><br> > > > <input type=\"submit\" name=\"send\" > > > value=\"test\"> > > > </form> > > > "; > > > > > > }else{ > > > > > > print $select; > > > > > > } > > > ?> > > > > > > I'm de missing something ... can sombody please lend a hand .. thanks > > > > > > Henti Smith > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > > For additional commands, e-mail: php-general-help@lists.php.net > > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#36184) next »