I am trying to implement a drop down menu for a form. The select name should be a field(topicName) from the MySQL db, and the select value should be another field(topicId) which is also the key for the table. My script is returning the topicName properly, but not the topicId. Any ideas?
Here's the code:
<?
dbConnect("jmcclure_MyNotes");
print "<select name='topicParent'>";
print "<option value = 'new'>New Page</option>";
$queryA = "SELECT topicId FROM topicsTable WHERE topicParent = 'NULL'";
$queryB = "SELECT topicName FROM topicsTable WHERE topicParent = 'NULL'" ;
$resultA = mysql_query($queryA) or die ("Query 'A' Failed");
$resultB = mysql_query($query😎 or die ("Query 'B' Failed");
while($topId = mysql_fetch_assoc($resultA)){
foreach($topId as $col=>$valA){
print "<option value= $valA>";
}
}
while($topName = mysql_fetch_assoc($result😎){
foreach($topName as $col=>$val😎{
print "$valB";
}
}
print "</select>";
?>