php - Implementing another list dropdown upon extra selection -
i have mysql database, , have option displays 'treatments' dropdown box on html page. how go implementing code, if user wants select more 1 treatment, dropdown box appear?
edit: e.g. lets shopping items online, , have items listen in dropdown box. pick one, , want pick more. click: 'add more' , dropdown appears on page can select item.
here php code:
<?php $hostname = 'hostname'; $dbname = 'dbname'; $username = 'username'; $password = 'password'; $con=mysql_connect($hostname,$username,$password,$dbname) or die("failed connect mysql: " . mysql_error()); $db=mysql_select_db($dbname,$con) or die("failed connect mysql: " . mysql_error()); $query = "select * `treatments`"; $result = mysql_query($query, $con); $options = ""; if (!$result){ die("no results found."); } while ($row = mysql_fetch_array($result)){ $options .= "<option>$row[1]</option>"; } ?>
actually need make multiselect drop down. if add multiple = "multiple"
html tag drop down used multi select.
<select name="anyname[]" multiple> <?php while ($row = mysql_fetch_array($result)){ echo "<option>$row[1]</option>"; } ?> </select>
for more need link. jquery multiselect drop down menu
hope you.
thanks
Comments
Post a Comment