I have a drop down form item with four options.
<p>Priority:
<select required name=\"priority\">
<option default value=\"1\">1 - 10 days</option>
<option value=\"2\">2 - 5 days</option>
<option value=\"3\">3 - 48 hours</option>
<option value=\"4\">4 - 24 hours</option>
</select>
</p>
These values are already stored in the SQL database with either 1,2,3,4. The page I am working on is an edit page of sorts, so I would like to have whichever value is set in the database be selected on the drop down, so the user does not have to reselect the value upon submission. How can I get it to find the value and select the correct option depending what is set? I have no problem doing this with a text field like this:
echo "<p>Cost: <input required type=\"text\" name=\"cost\" value=\"".$cost."\">";
Do I have to do four different if statements for each value (if ($priority == 1) {...}) etc.?