ronnie88 Posted August 1, 2008 Share Posted August 1, 2008 Here is my form <form action="insertsup.php" method="post"> <br><tr><td>UserName:</td><td><input type="text" name="username2" maxlength="25"></td> <tr><td>Email:</td><td><input type="text" name="email" maxlength="25"></td><br> <tr><td>Phone:</td><td><input type="text" name="phone" maxlength="25"></td><br> <tr><td>PayPal Email:</td><td><input type="text" name="paypal" maxlength="25"></td><br> <input type="hidden" name="order" value="ORDERSUP" /> <tr><td><input name="add" type="submit" id="add" value="Submit and go to billing"></td></form></tr> and insertsup.php <?php session_start(); include 'database.php'; $name = $_POST['username2']; $email = $_POST['email']; $phone = $_POST['phone']; $paypal = $_POST['paypal']; $order = $_POST['order']; $characters = $_POST['characters']; mysql_query("insert into orders(username2, email, phone, paypal, order, size, theme, characters) values('$name', '$email', '$phone', '$paypal', '$order', '', '', '')"); header('Location: http://www.greatdiscountedgames.com/site_flash/ordersent1.html'); ?> when i do a mysql error i get this: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order, size, theme, characters) values('Ronnie', '[email protected]', '123456789' at line 1 I know it has something to do with the hidden field.. any help greatly appreciated EDIT: maybe a mysql reserved word? Link to comment https://forums.phpfreaks.com/topic/117667-solved-hidden-field-and-mysql-and-php/ Share on other sites More sharing options...
DarkWater Posted August 1, 2008 Share Posted August 1, 2008 It has nothing to do with the hidden field. The word "order" is a MySQL reserved word, so change the column name. P.S: You could enclose order in ` `, but it's highly unsuggested because not all database servers accept that as valid SQL so I'd just rename the column. Link to comment https://forums.phpfreaks.com/topic/117667-solved-hidden-field-and-mysql-and-php/#findComment-605247 Share on other sites More sharing options...
ronnie88 Posted August 1, 2008 Author Share Posted August 1, 2008 thanks just had that idea right after i finished posting Link to comment https://forums.phpfreaks.com/topic/117667-solved-hidden-field-and-mysql-and-php/#findComment-605249 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.