Since this is only one customer, how can I carry this $total from the submit button to the next page for INSERT into database
punches page
<p>Is this the correct total of punches?</P>
<form action="run_punches.php" method="post" >
<?php
$small = $_REQUEST['smallamount'];
$medium = $_REQUEST['mediumamount'];
$large = $_REQUEST['largeamount'];
$total = $small + $medium + $large
?>
<input name="submit" type="submit" Value="Punchcard <?php echo $total; ?> times"/>
</form>
<form action="punchcard.php" method="post">
<input type="submit" value="No, take me back">
</form>
Example: Submit shows " Punchcard 2 times "
I want to click
then add to database
<?php
$small = $_REQUEST['smallamount'];
$medium = $_REQUEST['mediumamount'];
$large = $_REQUEST['largeamount'];
$total = $small + $medium + $large
$con = mysql_connect("localhost","user","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database_name", $con);
mysql_query("UPDATE punchcards SET smoothies = '$_REQUEST['$total']'
WHERE punchcard = 'punchcard' AND LastName = 'Griffin'");
echo "punches added";
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database_name", $con);;
$result = mysql_query("SELECT $punchcard FROM table_name");
while($row = mysql_fetch_array($result))
{
echo "<td>" . $row['punches_recorded'] . "</td>";
}
;
mysql_close($con);