saving category name into db instead of id number
Posted: Mon Feb 14, 2011 7:28 pm
hi.
i'm using the following code to list salutations from a salutations table. The user can select the salutation, but when my sql runs, it inserts the ID number. I really need it to insert the actual salutation. Any assistance would be appreciated. thx.
<label>
<?php
$result=mysql_query("select * from salutations");
$options="";
while ($row=mysql_fetch_array($result)) {
$id=$row["SalutationID"];
$categoryname=$row["Salutation"];
$options.="<OPTION VALUE=\"$id\">".$categoryname.'</option>';
}
?>
<select name="Salutation">
<option value="0">< select salutation > <?php echo $options ?></option>
</select>
</label>
i'm using the following code to list salutations from a salutations table. The user can select the salutation, but when my sql runs, it inserts the ID number. I really need it to insert the actual salutation. Any assistance would be appreciated. thx.
<label>
<?php
$result=mysql_query("select * from salutations");
$options="";
while ($row=mysql_fetch_array($result)) {
$id=$row["SalutationID"];
$categoryname=$row["Salutation"];
$options.="<OPTION VALUE=\"$id\">".$categoryname.'</option>';
}
?>
<select name="Salutation">
<option value="0">< select salutation > <?php echo $options ?></option>
</select>
</label>