Code: Select all
<?PHP echo "<select name='months' id='months'>\n
<option value=\"'%'\">Select</option>";
while($dbRow = mysql_fetch_array($GetMonths)){
echo "<option value='"
. $dbRow["months_idpk"]
. "'>"
. $dbRow["name"]
."</option>\n";
} echo "</select>\n";
?>January
February
March
I’m really stuck though as I want to insert into my database one of the three options i.e. January February March but what I’m getting inserted into my data base at the moment is the months_idpk id i.e. the numeric values 1, 2 or 3.
I’m using this to insert my data and have tired a few variations on it but I still get the same numeric values inserted. Can this be done or do I need to run another query before I make the final insert?
Code: Select all
$insertSQL = sprintf("INSERT INTO enquiries (months) VALUES (%s )",
GetSQLValueString($_POST['months'], "text"),Code: Select all
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($dbRow["name"], "text"),B