HOW-to: PHP Multiple Select List Box quick and easy..

Sometimes you find that it requires a little looping to get data from a form when using PHP and Multiple select list boxes. Here is a quick and easy way to loop through select data sent from a form in html. We also show you here how to use a Array of data to create the options. This is great if your doing a database query and need to use

Sometimes you find that it requires a little looping to get data from a form when using PHP and Mulitple select list boxes. Here is a quick and easy way to loop through select data sent from a form in html. We also show you here how to use a Array of data to create the options. This is great if your doing a database query and need to use that data in select box.

HTML :

select id="select[]" multiple="multiple" name="select[]" size="10"

option value=" . $listID . ">" .$listItem. ""; } /option /select

input id="button" name="button" type="submit" value="Submit" /

if (isset($_POST['select'])) {
$az = $_POST['select'];
foreach ($az as $a)
{
echo $a;
}
}

 

2 thoughts on “HOW-to: PHP Multiple Select List Box quick and easy..”

  1. Hello there I am so glad I found your blog page, I really found you by accident,
    while I was searching on Yahoo for something else, Regardless
    I am here now and would just like to say many thanks for
    a marvelous post and a all round interesting blog (I also
    love the theme/design), I don’t have time to browse it all at the moment but I have bookmarked it
    and also included your RSS feeds, so when I
    have time I will be back to read much more, Please do keep up the superb work.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.