I'm using a php script to generate some html form pages and I'm having a strange problem
with the select menus. The default value is not being selected. The code I am using is -
<select name="test" id="test">
<option value="">Select</option>
<option value="One" selected>One</option>
<option value="Two">Two</option>
<option value="Three">Three</option>
</select>
This does not generate the same source code and "Select" is selected on the page generated by the browser
instead of "One".
The browser source code looks like this (notice the space where the word "selected" should appear)
<select name="test" id="test">
<option value="">Select</option>
<option value="One" >One</option>
<option value="Two">Two</option>
<option value="Three">Three</option>
</select>
I've tried numerous different things including using selected="selected" but the only thing that seems
to work is using the following (notice I have deleted the space before the word "selected")
<select name="test" id="test">
<option value="">Select</option>
<option value="One"selected>One</option>
<option value="Two">Two</option>
<option value="Three">Three</option>
</select>
This generates the same source code and "One" is selected on the page generated by the browser as it should be.
Does anyone know what the problem is and why it is not occurring on all select menus, only on some.
Thanks.
with the select menus. The default value is not being selected. The code I am using is -
<select name="test" id="test">
<option value="">Select</option>
<option value="One" selected>One</option>
<option value="Two">Two</option>
<option value="Three">Three</option>
</select>
This does not generate the same source code and "Select" is selected on the page generated by the browser
instead of "One".
The browser source code looks like this (notice the space where the word "selected" should appear)
<select name="test" id="test">
<option value="">Select</option>
<option value="One" >One</option>
<option value="Two">Two</option>
<option value="Three">Three</option>
</select>
I've tried numerous different things including using selected="selected" but the only thing that seems
to work is using the following (notice I have deleted the space before the word "selected")
<select name="test" id="test">
<option value="">Select</option>
<option value="One"selected>One</option>
<option value="Two">Two</option>
<option value="Three">Three</option>
</select>
This generates the same source code and "One" is selected on the page generated by the browser as it should be.
Does anyone know what the problem is and why it is not occurring on all select menus, only on some.
Thanks.