hello guys,i am having a problem when i want to post some variables using multiple forms.please i need some help.
the first file contains the following:
<?php
if(isset($_GET["submit"]) && $_GET["submit"])
{
$qty1=$_POST["qty1"];
$qty2=$_POST["qty2"];
$qty3=$_POST["qty3"];
$qty4=$_POST["qty4"];
$qty5=$_POST["qty5"];
}
else
{
?>
<table border="3" align="center" width="90%" >
<tr><BR><BR>
<th bgcolor="#ECD672" align="center">¸éäïò Êáõóßìïõ</th>
<th bgcolor="#ECD672" align="center" >ÏêôÜíéá</th>
<th bgcolor="#ECD672" align="center">ÔéìÞ</th>
<th bgcolor="#ECD672" align="center" width="20%">Ðïóüôçôá/Lt</th>
</tr>
<?php
$sql = "SELECT * FROM tbl_product WHERE prd_category=1";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
?>
<form action="purchase1.php" name="purchase_form" method="post" onSubmit="return checkContent();">
<tr>
<td align="center"><?php echo $row["prd_name"];?></td>
<td align="center"><?php echo $row["prd_octane"];?></td>
<td align="center"><?php echo $row["prd_price"];?></td>
<td align="center">
<select name="qty1">
<option value="qty1">0</option>
<option value="qty2">200</option>
<option value="qty3">400</option>
<option value="qty4">600</option>
<option value="qty5">1000</option>
</select>
</td>
</tr></form>
<?php
}
?>
<?php
$sql = "SELECT * FROM tbl_product WHERE prd_category=2";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
?>
<form action="purchase1.php" name="purchase_form" method="post" onSubmit="return checkContent();">
<tr>
<td><?php echo $row["prd_name"]; ?></td>
<td><?php echo $row["prd_octane"]; ?></td>
<td><?php echo $row["prd_price"]; ?></td>
<td align="center">
<select name="qty2">
<option value="qty1">0</option>
<option value="qty2">200</option>
<option value="qty3">400</option>
<option value="qty4">600</option>
<option value="qty5">1000</option>
</select>
</td>
</tr></form>
<?php
}
?>
<?php
$sql = "SELECT * FROM tbl_product WHERE prd_category=3";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
?>
<form action="purchase1.php" method="post" onSubmit="return checkContent();">
<tr>
<td><?php echo $row["prd_name"]; ?></td>
<td><?php echo $row["prd_octane"]; ?></td>
<td><?php echo $row["prd_price"]; ?></td>
<td align="center">
<select name="qty3">
<option value="qty1">0</option>
<option value="qty2">200</option>
<option value="qty3">400</option>
<option value="qty4">600</option>
<option value="qty5">1000</option>
</select>
</td>
</tr></form>
<?php
}
?>
<?php
$sql = "SELECT * FROM tbl_product WHERE prd_category=4";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
?>
<form action="purchase1.php" name="purchase_form" method="post" onSubmit="return checkContent();">
<tr>
<td><?php echo $row["prd_name"]; ?></td>
<td><?php echo $row["prd_octane"]; ?></td>
<td><?php echo $row["prd_price"]; ?></td>
<td align="center">
<select name="qty4">
<option value="qty1">0</option>
<option value="qty2">200</option>
<option value="qty3">400</option>
<option value="qty4">600</option>
<option value="qty5">1000</option>
</select>
</td>
</tr>
</form>
<?php
}
?>
<?php
$sql = "SELECT * FROM tbl_product WHERE prd_category=5";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
?>
<form action="purchase1.php" name="purchase_form" method="post" onSubmit="return checkContent();">
<tr>
<td><?php echo $row["prd_name"]; ?></td>
<td><?php echo $row["prd_octane"]; ?></td>
<td><?php echo $row["prd_price"]; ?></td>
<td align="center">
<select name="qty5">
<option value="qty1">0</option>
<option value="qty2">200</option>
<option value="qty3">400</option>
<option value="qty4">600</option>
<option value="qty5">1000</option>
</select>
</td>
</tr></form>
<?php
}
?>
</table>
<BR><BR>
<form action="purchase1.php?submit=OK" name="purchase_form" method="POST">
<input class="nav-subs" type="image" src="../images/go.gif" value="submit" />
</form>
</div>
and in the second file i want to see if this variable has it's value
<?php include("../common/config.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<body>
<?php
echo "$qty1";
?>
</body>
</html>