PHP/MySQL Form Syntax Error!

Hey!
I made this php form and want to make it submit to a table, and later i will extract tha data from the table into an html page.
But the form wont work when submited. Here’s where I’m using it at the moment.

(btw, it’s in swedish :P)

The code of the form:

[code]
Förnamn:


Efternamn:




Email:




Telefon Nummer:



Beskriv din möbel:



Antalk Möbler:

[/code]

The post1.php code:

<?php
// Make a MySQL Connection
mysql_connect("SECRET","SECRET","SECRET") or die(mysql_error());
mysql_select_db("SECRET") or die(mysql_error());

mysql_query("INSERT INTO order (firstname, lastname, email, telenr, jobb, antal)
VALUES('$_POST[firstname]','$_POST[lastname]','$_POST[email]','$_POST[telenr]','$_POST[jobb]','$_POST[antal]')")
or die(mysql_error());


echo "Thank You!";

mysql_close($con)
?>

And what error message do you see, when the form is submitted?

I see your table name is order which is actually a reserved word in MySQL. Try to escape it with backticks:

INSERT INTO `order` 

OMG! ITS WORKING! THANK YOU SOOO MUCH! :o
I’ve looked everywhere for help, thank you tons and tons!
I LOVE YOU! :slight_smile:

btw, i tried to submitt a link, but I Failed… :stuck_out_tongue:

Sponsor our Newsletter | Privacy Policy | Terms of Service