I want to update my form when I click edit button then all info is showing correctly but status value is showing all time same open option. I dont know why it is showing same open status and my currently status is done but it is showing all time open please help me to fix this issue thanks
this is my form code username is showing correctly but status is not showing correct
<p><label class="field" for="username">UserName:</label>
<input name="username" type="text" id="username" value="<?php echo $username; ?>" size="50" />
</p>
<p>
<label class="field" for="Status">Status</label>
<select name="status" id="status" value="<?php echo $status; ?>" >
<option value="open">Open</option>
<option value="done">Done</option>
<option value="pending">Pending</option>
<option value="working">Working</option>
</select>
</p>
A select box also called drop down box provides an option to list down various options in the form of drop down list. You can also preselect a value in dropdown list of items in HTML forms. For that, add selected in the <option> tag for the value you want to preselect.
In the same or in another spreadsheet, select a cell or several cells in which you want your primary drop-down list to appear. Go to the Data tab, click Data Validation and set up a drop-down list based on a named range in the usual way by selecting List under Allow and entering the range name in the Source box.
Select the cell where you want the Dependent/Conditional Drop Down list (E3 in this example). Go to Data –> Data Validation. In the Data Validation dialog box, within the setting tab, make sure List in selected. In the Source field, enter the formula =INDIRECT(D3).
Use selected
attribute.
<select name="status" id="status">
<option value="open" <?php if($status=="open") { echo "selected"; } ?> >Open</option>
<option value="done" <?php if($status=="done") { echo "selected"; } ?> >Done</option>
<option value="pending" <?php if($status=="pending") { echo "selected"; } ?> >Pending</option>
<option value="working" <?php if($status=="working") { echo "selected"; } ?> >Working</option>
</select>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With