Re: Mulitple selects from form drop down box

From: Date: Thu, 20 Nov 2003 22:12:36 +0000
Subject: Re: Mulitple selects from form drop down box
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-170500@lists.php.net to get a copy of this message
From: "Jeff McKeon" <jmckeon@telaurus.com> > Is it possible to have a form "Drop down box" that allows multiple > selects? I know the form field itself exists, but It only seems to > return the last item selected and not all of them. > > Note in the code below the line: <select size="1" name="D1" multiple> This is the expected behavior. You're passing a bunch of "D1" variables in the form data, each one overwriting the other in the $_POST array. What you need to do is name you select element as an array. <select size="1" name="D1[]" multiple> Now $_POST['D1'] will be an array of all the items that were chosen. ---John Holmes... ps: wouldn't it be easier to select multiple items if you had a size larger than "1"??

« previous php.general (#170500) next »