hey guys so this piece of coding is simple and straight forward but theres something wrong with it and its bugging me out because i can't figure out what the problem is. the error i get is 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 'INSER INTO contact VALUES ('','Mr','Nor Marzuki','Musa','Q-16-A Tiara Damansara'' at line 1

php and html :

<?php
if(isset($_POST['save_contact']))
{
    require "connection.php";
    $salutation=mysql_real_escape_string($_POST['salutation']) or die(mysql_error());
    $fname=mysql_real_escape_string($_POST['firstname']) or die(mysql_error());
    $lname=mysql_real_escape_string($_POST['lastname']) or die(mysql_error());
    $houseone=mysql_real_escape_string($_POST['houseone']) or die(mysql_error());
    $housetwo=mysql_real_escape_string($_POST['housetwo']) or die(mysql_error());
    $housethree=mysql_real_escape_string($_POST['housethree']) or die(mysql_error());
    $tel=mysql_real_escape_string($_POST['telno']) or die(mysql_error());
    $off=mysql_real_escape_string($_POST['offno']) or die(mysql_error());

    $add=mysql_query("INSER INTO contact VALUES ('','$salutation','$fname','$lname','$houseone','$housetwo','$housethree',$tel','$off')") or die(mysql_error());
}
?>

<form name="addcontact" method="POST" action="contact_data.php">
        <legend><font face="Arial">Add Contact</font></legend>
        <font face="Arial">Salutation: </font><select name="salutation"><option value="" disabled selected>Choose</option><option value="Mr">Mr</option><option value="Mrs">Mrs</option></select></br>
        <font face="Arial">First Name:</font> <input type="text" name="firstname" /> Last Name: <input type="text" name="lastname"  /></br>
        <font face="Arial">Address Line 1:</font><input type="text" name="houseone" /></br>
        <font face="Arial">Address Line 2:</font><input type="text" name="housetwo" /></br>
        <font face="Arial">Address Line 3:</font><input type="text" name="housethree" /></br>
        <font face="Arial">Telephone No.:</font> <input type="text" name="telno" /> Office No.: <input type="text" name="offno" /></br>
        <p style="float:right;"><input type="submit" name="save_contact" id="add_contact" value="Add Contact" /><input type="submit" id="cancel_add" name="cancel_add" value="Cancel" /></p>
    </form>

i tried changing the names, i even changed the html layout because it was suppose to have houseno,streetname,postcode etc. so i dont know whats wrong. i can't see whats wrong. help me out please. thank you.

INSERT rather than INSER

Try this:

$add=mysql_query("INSERT INTO contact VALUES ('','$salutation','$fname','$lname','$houseone','$housetwo','$housethree',$tel','$off')") or die(mysql_error());

OMG... thats gotta be it. ugh, im going blind. Thanks guys!

Awesome, glad to have participated in helping. If you feel the problem's fully resolved, please mark this thread as solved by clicking the little 'Mark Question Solved' button under the reply box :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.