Re: parsing select multiple="multiple"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tamouse mailing lists wrote:

> On Mon, Feb 18, 2013 at 6:54 PM, John Taylor-Johnston
> <John.Taylor-Johnston@xxxxxxxxxxxxxxxxxxxxx> 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">

More info at http://www.php.net/manual/en/language.variables.external.php 
(search for multiple) and 
http://www.php.net/manual/en/faq.html.php#faq.html.select-multiple

-- 
Cheers
David Robley

Know what I hate? I hate rhetorical questions!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux