I have made a form where I can edit data from a database.
First I have collected the data from a ID number ex.
$firstname=$row['Firstname'];
$something=$row['Something'];
Then I have made a form where i write:
<input type="text" name="fieldname" value="<?echo $firstname;?>">
This way I writes the data in the field, and I can then edit it or leave it as it is, before I Update the database with the editted info.
But I have some fields which can only contain 2 or 3 different info, and these field are selected like this in the form:
<select name="something">
<option>1 chose</option>
<option>2 chose</option>
<option>3 chose</option>
</select>
But how do I get this to automaticly be set to the value already choosen in the database.
If the field something is ex. Chose 2, the selection should be sat to Chose 2 when I enter the site.
I have tried with
<select name="something" value="<?echo $something;?>">
<option>1 chose</option>
<option>2 chose</option>
<option>3 chose</option>
</select>
But this doesn't work on a "select" for some reason.
How do I do that ??
Michael