Forum Moderators: coopster
I have a table called countries, and the row is called country_name (in which ive listed about 4 countries so far
<form action="<?php echo($self);?>" method="post">Forename:<input type="text" name="fname" size="8">
Surname:<input type="text" name="sname" size="8">
<br><br>
<?php
$sql ="SELECT country_name FROM countries";
$query = mysql_query($sql);
echo '<select name="cntry">';
while
($row = mysql_fetch_array($query))
{
echo '<option value="',$row['country_name'],'">',$row['country_name'],'</option>';
}
echo '</select>';
?>
<!-- Country:<input type="text" name="cntry" size="8">-->
Gender:<input type="text" name="sex" size="8">
<input type="submit" value="Add to database"> </form>
The select box appears, but with all options being "0"
Any ideas?
Turns out when i created the table, i'd set the TYPE to INT, so anything other than numbers that i entered came up as 0.
The code above works great! (I think i added $conn in: $sql ="SELECT country_name FROM countries";
$query = mysql_query($sql,$conn);
)
So.. nothing to see here, look the other way ;)