Can any one help me with this..
i have an option box like this
<select name="facility_info_input[facility_type_id]" id="facility_type_id">
<option value=1 >Room</option>
<option value=2 >Equipment</option>
</select>
i want to select one of the above options automatically according to the variable value(before user filling/updating the form the option should be already selected),
As an example i have a data variable(read from the database) and its value is 1 /2 , if its 1 can this “Room” option automatically selected,
I have been trying to use selected=”selected” attribute, but still I couldn’t figure it out how to use it,is their a any other way?
Thank you in advance..
Add
selected="selected"to the option you want selected by default. I am assuming you are doing this server side.Also, you need to enclose your attributes in quotation marks. This may be why your code wasn’t working.