patheticsam Posted March 26, 2010 Share Posted March 26, 2010 Hi! I have a little issue here. I have a small form and I want to insert it into a MySQL DB. Here's the form code : <form id=\"order\" name=\"order\" method=\"post\" action=\"members/order.php\"> <input type=\"hidden\" name=\"itemid\" id=\"itemid\" value=\"".$info['item_id']."\"> <input type=\"hidden\" name=\"status\" id=\"status\" value=\"Unconfirmed\"> <input type=\"hidden\" name=\"payment\" id=\"payment\" value=\"Not received\"> <a href=\"members/order.php\"><img src=\"../img/buynow.jpg\" alt=\"Acheter\" /></a> </form> And here's the order.php part : <?php require_once('auth.php'); ?> <?php //Start session session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="fr"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <link href="../css/style2.css" rel="stylesheet" type="text/css" /> <title>LVA ENTERTAINEMENT</title> </head> <body> <?php $con = mysql_connect("localhost","login","pass"); $member = $_SESSION['SESS_MEMBER_ID']; $itemid = $_POST['itemid']; $status = $_POST['status']; $payment = $_POST['payment']; if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("DB", $con); $sql="INSERT INTO order ( item_id, member_id, status, payment) VALUES ('$member','$itemid','$status','$payment')";if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "<br /><br /><center>Votre artiste a correctement été ajouté à la base de donnée.<br /><br /><a href=\"../dashboard.php\" target=\"main2\">Retour au paneau de contrôle</a></center>"; ?> The problem is that the form is not passing the values itemid, status and payment.....The SESSION ID is inserted correctly but not the other values...... Does anyone sees what can cause this problem since i'm using the same script in other sections on my website and it works perfectly..... Please help! Thanks!! Link to comment https://forums.phpfreaks.com/topic/196627-problem-with-form-insert-please-help/ Share on other sites More sharing options...
jonsjava Posted March 26, 2010 Share Posted March 26, 2010 You weren't posting the data. You were having them click on a link to go to the post-process file. Try this: <form id='order' name='order' method='post' action='members/order.php'> <input type='hidden' name='itemid' id='itemid' value='".$info['item_id']."'> <input type='hidden' name='status' id='status' value='Unconfirmed'> <input type='hidden' name='payment' id='payment' value='Not received'> <imput type='image' src='../img/buynow.jpg' value='Submit' alt='Submit'></a> </form> Link to comment https://forums.phpfreaks.com/topic/196627-problem-with-form-insert-please-help/#findComment-1032364 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.