User already choose the option value and the data will entered database. I wanted to display back the data choose by user in option ways so when they wanted to edit just click on the option value.
`
<div class="row">
<div class="col-25">
<label for="sector">1. Type of Sectors</label>
</div>
<div class="col-75">
<select id="sector" name="sector" required>
<option value ="choose">Choose type of sector...</option>
<option value="National DefenceSecurity">National Defence and Security</option>
<option value="banking & Finance">Banking and Finance</option>
<option value="Information & Communication">Infomation and Communication</option>
<option value="Energy">Energy</option>
<option value="Transportation">Transportation</option>
<option value="Water">Water</option>
<option value="Health services">Health Services</option>
<option value="Government">Government</option>
<option value="Emergency Services">EmergencyServices</option>
<option value="Agriculture&food">Agriculture and Food</option>
<option value="Other">Other</option>
</select>
`
what should I change on this code ? or have to add other code to insert the function.
should be display the user option before want to exchange the data/Update
2
Answers
At the time of update you come with a previously selected value
like your previously selected value stored in a variable $slctr
you have to check all the option one by one with $slctr variable if value match any option make it select.
Then your edit code will be like.
You can done it by using jquery also