ok here is my selection script that is working fine. Now once I make the submit and call the next module with the hidden filed is where I'm
having trouble.
"this is working ok"
<html>
<SCRIPT>
function preprocess () {
mainform.DETAILS.value=mainform.FIRSTNAME.value+;
}
</SCRIPT>
<body>
<form name= mainform action="get_vendor_data.php" method="post" onsubmit="preprocess();">
<select name="fname">
<?php
//Get vendor
$vendor=$_POST['vendor'];
$db = mysql_connect("localhost", "xxx", "xxx");
mysql_select_db("vendors",$db);
$query = "SELECT * FROM data WHERE 2";
$result = mysql_query($query);
if (mysql_num_rows($result)) {
// loop through resulting rows, creating options
while ($row = mysql_fetch_row($result)) {
echo "<option value=\"".$row[0]."</option>"."\">".$row[2]."</option>";
}
}
?>
</select>
<input type = "submit">
<input type="hidden" name="vendor">
</form>
</body>
</html>
"This is the trouble area I need some help with"
<html>
<body bgcolor="#D3FFD0"><center>
<table>
<tr>
</tr>
<tr>
</tr>
<tr>
<?php
$db = mysql_connect("localhost","xxx","xxx");
mysql_select_db("vendors",$db);
$result = mysql_query("SELECT * FROM data where name=$_POST["vendor"]");
Note: the above query is NOT working but the one below "hand coded is" What am I doing wrong in the $_POST section??
$result = mysql_query("SELECT * FROM data where name='david'");
echo "<table border=1 bgcolor=teal>\n";
echo "<tr bgcolor=#d3ffdo><td>acct_num</td><td>name</td><td>addr1</td>
<td>city</td><td>st</td><td>zip</td><td>ph</td></tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr bgcolor=yellow> <td>%s</td><td>%s</td><td>%s<td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
$myrow[1], $myrow[2], $myrow[3], $myrow[4], $myrow[5]
, $myrow[6], $myrow[7]);
}
echo "</table>\n";
?>
</tr>
</table>
</body>
</html>
for some reason when I do the query with the name=$POST["vendor"]; it never brings back my information.
But if I hard code the name it works just fine.
So something in my use of the $POST is out of wack.
Any offers to adjust and / or fix would sure help me out a lot .
Thanks
Hodge.