Dawnshorses
10-20-2008, 02:01 AM
PHP file has these headers
<?php
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Expires: Mon. 17 Jan 2008 05:00:00 GMT");
header("Last-Modified: ". gmdate("D, F d y H:i:s"). " GMT");
include "include/session.php";
include "include/z_db.php";
session_start();
?>
Then html stuff with Form begining
<form action="<?php print $_SERVER['PHP_SELF']; ?>" method="post" >
It then pulls from the following link to db
<?php include "include/order_dbpull.inc"; $uc="UpdateCart"; ?>
Some more html and php. Then if the user clicks update
<?php
foreach($_POST as $field=>$value){
foreach($_POST['Pquantity'] as $element){
if(!is_numeric($element)){
echo "<p align='center'><font color='red' size='4'>You have entered an Invalid quantity.</font></p>";
include "include/footer4.php";
exit();
}}
if ($field == "UpdateCart") {
//updates quantity
$z=0;
$sql_q="SELECT * FROM OrderData WHERE session = '$order_number' ORDER BY Pnumber";
$resultq = mysql_query($sql_q,$link);
$_POST['Pquantity'] = array_reverse($_POST['Pquantity'], TRUE);
foreach($_POST['Pquantity'] as $field => $value){
if($z<=$cnt){
$pkn=$items[$i]['Pkey'];
$sql_quant=mysql_query("UPDATE OrderData SET Pquantity = '$value' WHERE PKey = '$pkn'");
}$z=$z+1;$i=$i-1;}
//end updates quantity code
//delete zero
$sql_d="DELETE FROM OrderData WHERE Pquantity=0 AND session = '$order_number'";
$resultd = mysql_query($sql_d,$link);
//end delete zero code
}}?>
The update works to the db but does not automatically re-display the new data. It does if you click refresh. How can i get the page to show automatically upon completion to the db?
<?php
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Expires: Mon. 17 Jan 2008 05:00:00 GMT");
header("Last-Modified: ". gmdate("D, F d y H:i:s"). " GMT");
include "include/session.php";
include "include/z_db.php";
session_start();
?>
Then html stuff with Form begining
<form action="<?php print $_SERVER['PHP_SELF']; ?>" method="post" >
It then pulls from the following link to db
<?php include "include/order_dbpull.inc"; $uc="UpdateCart"; ?>
Some more html and php. Then if the user clicks update
<?php
foreach($_POST as $field=>$value){
foreach($_POST['Pquantity'] as $element){
if(!is_numeric($element)){
echo "<p align='center'><font color='red' size='4'>You have entered an Invalid quantity.</font></p>";
include "include/footer4.php";
exit();
}}
if ($field == "UpdateCart") {
//updates quantity
$z=0;
$sql_q="SELECT * FROM OrderData WHERE session = '$order_number' ORDER BY Pnumber";
$resultq = mysql_query($sql_q,$link);
$_POST['Pquantity'] = array_reverse($_POST['Pquantity'], TRUE);
foreach($_POST['Pquantity'] as $field => $value){
if($z<=$cnt){
$pkn=$items[$i]['Pkey'];
$sql_quant=mysql_query("UPDATE OrderData SET Pquantity = '$value' WHERE PKey = '$pkn'");
}$z=$z+1;$i=$i-1;}
//end updates quantity code
//delete zero
$sql_d="DELETE FROM OrderData WHERE Pquantity=0 AND session = '$order_number'";
$resultd = mysql_query($sql_d,$link);
//end delete zero code
}}?>
The update works to the db but does not automatically re-display the new data. It does if you click refresh. How can i get the page to show automatically upon completion to the db?