I'm trying to retrieve data from a SQL DB when the user types a category ID in to search with. It should then autofill (populate) the html form data with the retrieved data from the row's columns (upon pressing the submit button).
Everything is working properly, but I don't know how to change a dropdown menu
For example:
<input name="prodname" type="text" value="<?php echo $pName; ?>"/>
Fills the form value successfully after I press the search(submit) button.
This following code does not change the drop down values at all (<select> vs <input>)
<select name="supplierID" value="<?php $suppID; ?>">
How can I change the drop down values of a while only using HTML/PHP?
Thank you.
optionelement within theselect.selectedattribute on the selectedoptionelement. Just setting the value of theselectelement won't work IIRC.<select name="supplierID" value="<?php $suppID; ?>"> <option value="1">1</option> <option value="2">2</option>etc...