I'm trying to create an "editable" drop down list. I have a drop down list populated from a table "city" in my db, it works perfect but now I want user to be able to add a new value to the list if it doesn't exist there (and I want to save this value, so next time it appears in the drop down list). Any ideas? Thank you
<select name="city">
<?php
// connecting to DB
$con= mysqli_connect('localhost','root','1234','e-sage');
// enable hebrew input
mysqli_set_charset($con,'utf8');
// read the city table from DB
$sql = mysqli_query($con,"SELECT CityName FROM city");
while ($row = mysqli_fetch_array($sql)){
// creating temporary variable for each row
$city1=$row["CityName"];
//assigning a value to each option in dropdown list
echo "<option value=\"$city1\"> $city1 </option>";
}
?>
</select>