I wish to update a record in MySql with PHP. Update is done with a standard HTML form including a drop down select populated from an Mysql query. Options are those already existing for that field in the data base
<?php
$records = mysqli_query($conn, "SELECT DISTINCT `TDATE` FROM `MASTER_TABLE` WHERE `TDATE` <> 'TDATE' AND `TDATE` <> '' ");
echo "<option value=''>" ."" ."</option>"; // this just to give a blank entry field
while($data = mysqli_fetch_array($records))
{
echo "<option value='". $data['TDATE'] ."'>" .$data['TDATE'] ."</option>"; // displaying data in option menu
}
?>
That works fine of course - giving a blank field from the added option statement. ( I could take out the second part of the SQL query which would have the same effect) But I would like the user to be able to enter a new option into that blank field in the dropdown. But no approach seems quite to work tidely. ( That entered option will go into the database and appears in subsequent dropdown lists - thats already coded and working).
Thanks for answers so far .
Seems to be still problems with some browsers on datalist.
I got round it fornow by adding in another input field which takes priority but thats not very elegant.
I have no problem doing it within MSOffice apps just rather presumed there was a standard way of doing it