Hello,
I'm trying to sort how to do the following: I have one table from which I'm taking 2 fields/variables with the following code, and there is a second table into which I need to insert BOTH of these variables:
$results= mysql_query("SELECT am_code, am_title
FROM area_master
ORDER BY am_id");
while($myrow = mysql_fetch_array($results)) {
$lista=$lista."<option value='$myrow[am_code]'>$myrow[am_code] - $myrow[am_title]</option>\n";
}
$lista=$lista."</select>\n";
$dropdowna="<select size=1 name='am_code'>\n".$lista;
echo $dropdowna;
Then for the insert:
$am_code=$_POST['am_code'];
Obviously this only inserts the "$am_code" (when I want to also insert "$am_title"). I tried this:
$resultb= mysql_query("SELECT am_title
FROM area_master
WHERE am_code='$_POST[am_code]'");
while($myrow = mysql_fetch_array($resultb)) {
$areaf="$myrow[am_title]";
}
as part of the input, but still nothing.
What's the proper way to do this?
thanks for any suggestions...