anne3marie Posted June 19, 2012 Share Posted June 19, 2012 I have a form which post to this page and the update is not happening. What did I do wrong? I also tried removing the where clause to see if that was the problem but it still did not work. Thanks! <?php include 'db.php'; session_start(); $user=$_SESSION['userid']; $box_selection=$_POST["box_selection"]; $agree=$_POST["agree"]; $payment=$_POST["payment"]; $sql = mysql_query("Update grocery_cart SET order_size='$box_selection', pp_check='$agree', payment='$payment' WHERE userid='$user'"); if(!$sql){ echo 'Your request was not submited, please contact NewLeaf Delivery';include'sign_up.php';} else{ echo "Your request has been received";include 'signed_up.php'; } ?> Thanks! Link to comment https://forums.phpfreaks.com/topic/264423-simple-update-form-not-working/ Share on other sites More sharing options...
sowna Posted June 19, 2012 Share Posted June 19, 2012 try like this $sql = mysql_query("Update grocery_cart SET order_size='".$box_selection."', pp_check='".$agree."', payment='".$payment."' WHERE userid='".$user."'"); Link to comment https://forums.phpfreaks.com/topic/264423-simple-update-form-not-working/#findComment-1355131 Share on other sites More sharing options...
PFMaBiSmAd Posted June 19, 2012 Share Posted June 19, 2012 What exactly is happening? Are you getting your - 'Your request was not submitted, please contact NewLeaf Delivery' message or your "Your request has been received" message? Link to comment https://forums.phpfreaks.com/topic/264423-simple-update-form-not-working/#findComment-1355160 Share on other sites More sharing options...
litebearer Posted June 19, 2012 Share Posted June 19, 2012 Also, for debugging purposes, it helps if you place your queries in a variable. You then can echo the variable to ascertain it contains what you expect. Link to comment https://forums.phpfreaks.com/topic/264423-simple-update-form-not-working/#findComment-1355164 Share on other sites More sharing options...
anne3marie Posted June 19, 2012 Author Share Posted June 19, 2012 Yes I am getting Your request was not submitted, please contact NewLeaf Delivery' If I place my query in a variable, I simple then echo the variable? Didn't I place my query in a variable? $sql is my variable. I am very new to this. How would I do that exactly? Link to comment https://forums.phpfreaks.com/topic/264423-simple-update-form-not-working/#findComment-1355197 Share on other sites More sharing options...
litebearer Posted June 19, 2012 Share Posted June 19, 2012 $query = "Update grocery_cart SET order_size='$box_selection', pp_check='$agree', payment='$payment' WHERE userid='$user'"; /* put query into a variable */ echo $query; /* testing the query */ Link to comment https://forums.phpfreaks.com/topic/264423-simple-update-form-not-working/#findComment-1355212 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.