I have a php form and php process page that I am using and I cannot tell if I wrote the code wrong, or my php is not working correctly, but I cannot get the POST info from the form.
Here is the full code for the order page:
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form action="process.php" method="post" name="SignOrder" id="SignOrder">
<?
$hostname = "localhost";
$database = "a";
$username = "b";
$password = "c";
$path = "images/";
$ID = $_POST['ID'];
$connpt = mysql_pconnect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($database, $connpt);
$result = mysql_query("SELECT * FROM dealeritems");
echo "<table>";
echo " <tr>".
" <td width=\"100\">".'ID'."</td>"."<td width=\"100\">".'Item Name'."</td>"."<td width=\"150\">".'Item Description'."</td>"."<td width=\"150\">".'Body Copy'."</td>"."<td width=\"100\">".'Image'.
" </tr>";
while ($row = mysql_fetch_assoc($result)) {
$ID = $row['ID'];
$ItemName = $row['ItemName'];
echo " <tr>".
" <td width=\"100\">".
$row['ID']."</td>".
"<td width=\"100\">".
$row['ItemName']."</td>".
"<td width=\"150\">".
$row['ItemDescription']."</td>".
"<td width=\"150\">".
$row['BodyCopy']."</td>".
" <td width=\"100\"><img src =$path".
$row['ImageName']." width=\"100\" height=\"125\"></td>".
"<td width=\"150\">".
"<input name=\"Order[]\" type=\"radio\" value=\"Ordered.$ID\">"."</td>".
"<td width=\"150\">".
"<select name=\"Quantity[]\" id=\"Quantity.$ID\">
<option value=\"0\">0</option>
<option value=\"1\">1</option>
<option value=\"2\">2</option>
<option value=\"3\">3</option>
<option value=\"4\">4</option>
<option value=\"5\">5</option></select>".
"</td>"." </tr>";
}
echo "</table>";
?>
<p> </p>
<p>
<input type="hidden" name="ID" value="<? echo $_POST['ID']; ?>">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
</p>
</form>
<p> </p>
</body>
</html>Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<?
$id = $_REQUEST['ID'];
$ID = $_POST['ID'];
/*$k = 0;
$j = 0;
while($id != 0)
{
$quantity = $_GET['Quantity'];
$ordered = $_GET['Ordered'];
foreach ($quantity as $key=>$qty) {
echo "Quantity: ".$qty." Ordered: ".$ordered[$key];
}
} */
$max=100;
echo $ID;
echo $id;
while($id != 0) {
$quantity = $_REQUEST['Quantity'];
$ordered = $_REQUEST['Ordered'];
for($i=1;$i<$max;$i++) {
echo "Quantity: ".$i." Ordered: ".$ordered.$i;
echo $i;
}
}
echo $quantity.$i;
echo $id;
echo $ID;
echo "<br>";
echo "Done!";
echo "<br>";
echo " Thank you for your order. You will be contacted when the order is complete.";
?>
</body>
</html>BTW, I originally had the Quantity and Ordered as a defined name and now they are a variable. This code was suggested by a user on this forum, and now once you select a product, it "de-selects" the previous product. I know there is a fix for this, also.
I can do a print_r for GET POST REQUEST and I get that info, so I am at the mercy of the users of this forum.
Thanks,
Don
feyd | Please review how to post code using
Code: Select all
andCode: Select all
tags. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]