Re: parsing select multiple="multiple"

From: Date: Tue, 19 Feb 2013 01:20:11 +0000
Subject: Re: parsing select multiple="multiple"
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-320241@lists.php.net to get a copy of this message
On Mon, Feb 18, 2013 at 6:54 PM, John Taylor-Johnston <John.Taylor-Johnston@cegepsherbrooke.qc.ca> wrote: > I am capable with <select name="DPRpriority">. (I suppose I did it > correctly? :p ) > But I haven't the first clue how to parse a <select multiple> and multiply > select name="DPRtype". > Would anyone give me a couple of clues please? :) > Thanks, > John > > Priority: > <select name="DPRpriority" form="DPRform"> > <option value="1" <?php if ($_POST["DPRpriority"] == > "1") {echo > "selected";} ?>>1</option> > <option value="2" <?php if ($_POST["DPRpriority"] == > "2") {echo > "selected";} ?>>2</option> > <option value="3" <?php if ($_POST["DPRpriority"] == > "3") {echo > "selected";} ?>>3</option> > <option value="4" <?php > if (empty($_POST["DPRpriority"])) {echo "selected";} > if ($_POST["DPRpriority"] == "4") {echo "selected";} > ?>>4</option> > </select> > > > <select multiple="multiple" name="DPRtype" > form="DPRform"> > <option value="1. Crimes Against Persons">1. Crimes Against > Persons</option> > <option value="2. Disturbances">2. Disturbances</option> > <option value="3. Assistance / Medical">3. Assistance / > Medical</option> > <option value="4. Crimes Against Property">4. Crimes Against > Property</option> > <option value="5. Accidents / Traffic Problems">5. Accidents / > Traffic Problems</option> > <option value="6. Suspicious Circumstances">6. Suspicious > Circumstances</option> > <option value="7. Morality / Drugs">7. Morality / > Drugs</option> > <option value="8. Miscellaneous Service">8. Miscellaneous > Service</option> > <option value="9. Alarms">9. Alarms</option> > </select> > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Do test this, but I think all that's required is you make the name an array: <select name="DPRpriority[]" form="DPRform">

« previous php.general (#320241) next »