Working with select box

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wafasn
Forum Newbie
Posts: 6
Joined: Tue Apr 06, 2004 11:10 am

Working with select box

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

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