Page 1 of 1

Working with select box

Posted: Mon May 24, 2004 12:45 pm
by wafasn
Hi everyone,

I hope someone can help me with this problem:

I have a form on page that looks like this:

<form method='post' action='b.php'>
<select name='subject[]' size='3' multiple='multiple'>
<option value='ALL'>Select All</option>
<option value='1'>Field 1</option>
<option value='2'>Field 2</option>
<option value='3'>Field 3</option>
<option value='4'>Field 4</option>
</select>
<input type='submit' name='Submit' value='Ok'>
</form>

As you see this form lets the user select multiple choices. I need to know how can I get the user selection with the POST method in my b.php file.
And also how to get the number of items selected.

Thanks in advance.

Posted: Mon May 24, 2004 2:49 pm
by feyd

Code: Select all

$subjects = $_POST['subject'];
$num = sizeof($subjects;