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

On December 30, 2009, in How-to, Scripting, by Cubert aka (Cube Dweller)

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.


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;


Tagged with:

1 Response » to “HOW-to: PHP Multiple Select List Box quick and easy..”

  1. Manoj says:

    how to set values to multiple list box using php

Leave a Reply


%d bloggers like this: