php form data is not entering my mysql database

Im creating a student information system. Im very new to php . I constructed a login system and it works. So now i need a form where the information can transferred to the database and can be used back to display. I have checked the naming which i thought is the problem but it is same with the phpmyadmin naming. i reli hope someone can help

this is my php coding

[php]

<?php session_start(); error_reporting(0); if($_POST['submit']) { $id = mysql_real_escape_string($_POST['id']); $first_name = mysql_real_escape_string($_POST['first_name']); $last_name= mysql_real_escape_string($_POST['last_name']); $gender= mysql_real_escape_string($_POST['gender']); $phone_number = mysql_real_escape_string($_POST['phone_number']); $email = mysql_real_escape_string($_POST['email']); $race= mysql_real_escape_string($_POST['race']); $religion= mysql_real_escape_string($_POST['religion']); $IC_number= mysql_real_escape_string($_POST['IC_number']); if($id && $first_name && $last_name && $gender && $phone_number && $email && $race && $religion && $IC_number) { require "dbc.php"; $query = mysql_query("INSERT INTO info_insert VALUES ) ('$id','$first_name','$last_name','$gender','$phone_number','$email','$race','$religion','$IC_number')"); echo "Student Information Saved! Click here to Enter Members Area"; } else { echo "All fields are required"; } } ?>[/php]

my code of html for the html

[code]

Student Information

Student Information

<form action="student_info.php" method="POST">
  <table width="565" height="425" border="0">
    <tr>
      <td height="31">Student ID :</td>
      <td><input name="id" type="text" value="" size="45"></td>
    </tr>
    <tr>
      <td width="216" height="23">First Name:</td>
      <td width="333">
      <input name="first_name" type="text" value="" size="45" maxlength="50"></td>
    </tr>
    <tr>
      <td>Last Name:</td>
      <td><input name="last_name" type="text" value="" size="45" maxlength="50"></td>
    </tr>
    <tr>
      <td>Gender :</td>
      <td>
      <input name="gender" type="text" value="" size="45" maxlength="50"></td>
    </tr>
    <tr>
      <td>Phone Number :</td>
      <td>
      <input name="phone_number" type="text" value="" size="45" maxlength="50"></td>
    </tr>
    <tr>
      <td>email :</td>
      <td>
      <input name="email" type="text" value="" size="45" maxlength="50"></td>
    </tr>
    <tr>
      <td>Race :</td>
      <td> <input name="race" type="text" value="" size="45" maxlength="50"></td>
    </tr>
    <tr>
      <td height="36">Religion :</td>
      <td><p>
        <input name="religion" type="text" value="" size="45" maxlength="50">
      </p></td>
    </tr>
    <tr>
      <td height="31">IC.number :</td>
      <td><input name="IC_number" type="text" value="" size="45"></td>
    </tr>
  </table>
  <p><p>
  <input type="submit" name="submit" value="Save">

*Student ID is the 4-last digits of their respective IC Numbers.

[/code]

pls reply if more details are needed… i really need to get this done

Replace your mysql_query by this line :
[php]$query = mysql_query(“INSERT INTO info_insert VALUES (’$id’,’$first_name’,’$last_name’,’$gender’,’$phone_number’,’$email’,’$race’,’$religion’,’$IC_number’)”);[/php]

You had an syntax error(I mean , you included an extra bracket in that line)

Sponsor our Newsletter | Privacy Policy | Terms of Service