Multiple Selection in HTML Dropdown with help of PHP Code

PHP Multiple Selection


To select multiple values as a dropdown, 'Foreach LOOP' is used. Now you can easily multiple selection in html dropdown with the help of PHP (Hyper Text PreProcessor Language)

For Example:

foreach($subject_array as $key=> $value)
echo "You choosed <b>" . $value . " </b> . <br>";

<!DOCTYPE html>

<meta charset="utf-8">
<title> Multiple Selection </title>

<h2> Choose your subject</h2> (Hold "ctrl" key to select multiple values)
<form action="" method="post" >
<select name="subject[]" multiple>
<option value="Hindi"> Hindi </option>
<option value="English"> English </option>
<option value="Mathematics"> Mathematics </option>
<option value="Physics"> Physics </option>
<option value="Chemistry"> Chemistry </option>
<option value="Biology"> Biology </option>
<option value="Sanskrit"> Sanskrit </option>
<input type="submit" name="sub" value="Submit">



Best WordPress Hosting


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price

Leave a Reply

    Waiting for your comments