Jump to content

count number of select


benchew0904

Recommended Posts

hi, I want to count the total number of multiple select that user has selected instead of getting the value the user has selected How should I go about doing the counting part?

 

<form action="1.php" method="post">
<select name="test[]" multiple="multiple">
<option value="one">one</option>
<option value="two">two</option>
<option value="three">three</option>
<option value="four">four</option>
<option value="five">five</option>
</select>
<input type="submit" value="Send" />
</form>


<?php
$test=$_POST['test'];
if ($test){
 foreach ($test as $t){echo 'You selected ',$t,'<br />';}
}
?>

 

Link to comment
https://forums.phpfreaks.com/topic/255000-count-number-of-select/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.