<?php
$category = isset($_GET['category']) ? $_GET['category'] : ""; //results will be "Private" or "Company" or empty
?>
<form>
<select name="customer_category" id="customer_category">
<option value="Private" /*if $category == "Private" {echo "selected";}*/ >Private Individual</option>
<option value="Company" /*if $category == "Company" {echo "selected";}*/>Company</option>
</select>
</form>
<button> Save Changes </button>
Very simplified example of what I’m trying to achieve. Loops and iterating over items have never been my strong point, can someone help me to select an option depending on a dynamic value?
This is going to be used in an edit form. I have the same question about getting the correct checkbox and radio option checked depending on a dynamic value. Any tips would be appreciated.
Thank you