Storing Dropdown option value
Posted: Thu Jan 28, 2010 12:39 am
Hello Everyone!!
I have creted a dropdown having two option YES/No & in mysql db i have taken field type tinyint(1)
Here is the code:
HTML Page:
<td align=right>is_fertilised</td>
<td><select name= "is_fertilized" style="width: 120px;">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select></td>
PHP code:
$sql1 = "INSERT INTO trees
(tree_id,is_fertilised,)
VALUES
('$_POST[tree_id]',
'$_POST[is_fertilized]'
)";
but in the db it inserting only 'o' value or some time '1' ? Please suggest how i can store Yes/No instead of 0 &1.Is it a good idea or i need to stick with tinyint itself.
Thanks in Advance!!
I have creted a dropdown having two option YES/No & in mysql db i have taken field type tinyint(1)
Here is the code:
HTML Page:
<td align=right>is_fertilised</td>
<td><select name= "is_fertilized" style="width: 120px;">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select></td>
PHP code:
$sql1 = "INSERT INTO trees
(tree_id,is_fertilised,)
VALUES
('$_POST[tree_id]',
'$_POST[is_fertilized]'
)";
but in the db it inserting only 'o' value or some time '1' ? Please suggest how i can store Yes/No instead of 0 &1.Is it a good idea or i need to stick with tinyint itself.
Thanks in Advance!!