inserting data into mysql from an html textboxes. using php/mysql
<p>I can't see where i am going wrong, it just won't let me connect to the mysql database and i only get error message when trying to save details.?????? i think there may be a problem where it shows $sql for inserting the values into the table. the first part newstudent.php works, but sql.php does not work. </p>

<pre><code>//new student.php
&lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
     &lt;h2&gt;Your details&lt;/h2&gt;
     &lt;form name="frmdetails" action="sql.php" method="post"&gt;
        ID Number :
     &lt;input name="txtid" type="text" /&gt;
        &lt;br/&gt;
    Password :
     &lt;input name="txtpassword" type="text" /&gt;
        &lt;br/&gt;
    Date of Birth :
     &lt;input name="txtdob" type="text" /&gt;
        &lt;br/&gt;
    First Name :
    &lt;input name="txtfirstname" type="text" /&gt;
        &lt;br/&gt;
        Surname :
        &lt;input name="txtlastname" type="text" /&gt;
    &lt;br/&gt;
        Number and Street :
    &lt;input name="txthouse" type="text"   /&gt;
        &lt;br/&gt;
        Town :
        &lt;input name="txttown" type="text"  /&gt;
    &lt;br/&gt;
        County :
    &lt;input name="txtcounty" type="text"   /&gt;
        &lt;br/&gt;
         Country :
    &lt;input name="txtcountry" type="text"   /&gt;
        &lt;br/&gt;
        Postcode :
        &lt;input name="txtpostcode" type="text"   /&gt;
        &lt;br/&gt;
        &lt;input type="submit" value="Save" name="submit"/&gt;
      &lt;/form&gt;
   &lt;/body&gt;
   &lt;/html&gt;

//sql.php
$conn=mysql_connect("localhost", "20915184", "mysqluser"); 
 mysql_select_db("db5_20915184", $conn);

// If the form has been submitted

$id=$_POST['txtstudentid'];
$password=$_POST['txtpassword'];
$dob=$_POST['txtdob'];
$firstname=$_POST['txtfirstname'];
$lastname=$_POST['txtlastname'];
$house=$_POST['txthouse'];
$town=$_POST['txttown'];
$county=$_POST['txtcounty'];
$country=$_POST['txtcountry'];
$postcode=$_POST['txtpostcode'];



    // Build an sql statment to add the student details
    $sql="INSERT INTO student

(studentid,password,dob,firstname,lastname,house,town,county,country,postcode) VALUES

('$id','$password','$dob','$firstname','$lastname','$house','$town','$county','$country','$postcode')";
    $result = mysql_query($sql,$conn);
        if($result){
echo"&lt;br/&gt;Your details have been updated";
echo "&lt;BR&gt;";
echo "&lt;a href='Home.html'&gt;Back to main page&lt;/a&gt;";
}

else {
echo "ERROR";
}

// close connection 
mysql_close($conn);
?&gt;
</code></pre>
