I need to store the user selected option when chosen from my drop down select box, and when submitted in my form, store in my MYSQL database.
I already have information being stored and displayed fine, i am just trying to add more content now. I have tried using the same method, but i cant get it to store what i want.
The select drop down looks like this inside my form:
<span> Difficulty: </span>
<select>
<option type="text" name="easy" id="easy" value="easy">easy</option>
<option type="text" name="comfortable" id="comfortable" value="comfortable">comfortable</option>
<option type="text" name="hard" id="hard" value="hard">hard</option>
<option type="text" name="veryhard" id="veryhard" value="veryhard">very hard</option>
<option type="text" name="hardest" id="hardest" value="hardest">Hardest ride in the world!</option>
</select>
</label>
and i am trying to send it using this:
$difficulty = mysql_real_escape_string($_POST['difficulty']);
Using this query:
$query = sprintf("INSERT INTO markers (difficulty) VALUES ('%s')", $difficulty);
When my table is set up as INT, 20, allow null, it stores 0 in the database. and when i set it up VARCHAR, 20, allow null, it stores a blank field.
i want it to store whichever value the user chooses, i.e easy, hard, very hard etc.
Thanks very much