Hi and Good day to you.
How can a create a dropdown list with an option to add a dynamic option to it.
If I want a static dropdown list in html I do as:
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat" selected="selected">Fiat</option>
<option value="audi">Audi</option>
</select>
If I want a file options I do as:
<?php
$con = mysql_connect("localhost","root","");
mysql_select_db("Stock1", $con);
$result3=mysql_query("SELECT item FROM item", $con);
if($result3) {
?>
<form id="form1" name="form1" method="post" action="welcome.php">
<select name="name" id="name">
<option input type="text" name="name" > </option>
<?php
while($rows=mysql_fetch_assoc($result3)) {?>
<option value="<?php echo $rows['item']?>" selected="name"><?php echo $rows['item'] ?></option>
<?php
}
mysql_free_result($result3);?>
</select>
<input type="submit" name="submit" value="تسليم"/>
</form>
<?php
}
else die("SQL failed.".$sql);
?>
I want to have an input option to be inserted into the select statement. How can I do that, please help me…