Howdy,
I need some help with some code. I pulling data from a database and then populating a form from that data. I am having a problem with one of the dropdown menus. Here is my code.
The sql query, this runs based on a variable that has two possible values, Create, or Modify. Modify, the first query runs, if it is Create, the second runs.
$resultID = mysql_query("SELECT * FROM jobs, property WHERE jobs.jobNum = '$jobNum' ORDER BY property.propMain", $linkID) or die(mysql_error());
while ($row = mysql_fetch_array($resultID))
{
$jobNum = $row["jobNum"];
$jobCode = $row["jobCode"];
$jobCat = $row["jobCat"];
$jobNam = $row["jobNam"];
$datePost = $row["datePost"];
$dateClos = $row["dateClos"];
$prop = $row["prop"];
$hours = $row["hours"];
$yearRnd = $row["yearRnd"];
$wint = $row["wint"];
$sum = $row["sum"];
$jobReq = $row["jobReq"];
$jobDesc = $row["jobDesc"];
$wage = $row["wage"];
$hourSal = $row["hourSal"];
$contNam = $row["contNam"];
$contPhon = $row["contPhon"];
$inqEmail = $row["inqEmail"];
$live = $row["live"];
$propMain = $row["propMain"];
$state = $row["state"];
}
}
else
{
$resultID = mysql_query("SELECT * FROM property ORDER BY propMain", $linkID) or die(mysql_error());
}
The $propMain is the variable that contains the properties that need to populate the dropdown list that I will list the code for next.
<td colspan="2"><font size="2" face="Arial, Helvetica, sans-serif">
<select name="prop" id="prop">
<?php
if ($action == "Modify")
{
print "<option selected>" . $prop . "</option>";
Here is where I am having a problem, I need an array to list the $propMain values, there are about 50 propertys that need to be listed,
}
else
{
print "<option selected>Choose One</option>";
}
?>
<?php
while ($row = mysql_fetch_array($resultID))
{
$propMain = $row["propMain"];
print "<option>" . $propMain . "</option>";
}
?>
</select>
</font></td>
Any ideas?
Thanks