I need some help with this project. I've gone as far as I can go, with no results, The inquiry form works, but I need to populate it with my sql table. I could only screen shot my sql and I have no idea of how to put it on here. The following is the scenerio: Uploading Information Directly into the Inquiry Table

In this scenario you will be using the inquiry form created in project 3, and the table named inquiry created in project 4. User responses’ must be uploaded into the inquiry table by using the MySQL statements. Add the code to upload the information to the inquiry table on the email.php file (the file used to send the emails from the inquiry form). To test that the results were uploaded into the table, use an if…else statement to display to the screen if the results were uploaded or not. Add at least 3 inquiry responses.

NOTE: Be sure the fields names of the inquiry form match the values variable names created to ensure the results are uploaded into the table. If problems with uploading the results, first look at the names of the fields, and order listed.This is my inquiry.php:

<!doctype html>



<meta charset="utf-8">

<title>Untitled Document</title>




$name = $_POST ['name'];

$address = $_POST ['address'];

$city = $_POST ['city'];

$state = $_POST ['state'];

$zip = $_POST ['zip'];

$phone = $_POST ['phone'];

$email = $_POST ['email'];

$major = $_POST ['major'];

$year = $_POST ['year'];

$semester = $_POST ['semester'];

$to="bmunn@mail.niagara.edu, therock691@gmail.com"; //an email is sent to your email account and to 

$message="To Whom It May Concern, <br>";

$message.="My information is listed below: <br><br>";

$message.="Name: $name<br>";

$message.="Address: $address<br>";

$message.="City: $city<br>";

$message.="State: $state<br>";

$message.="Zip: $zip<br>";

$message.="Phone: $phone<br>";

$message.="Email: $email<br>";

$message.="Major: $major<br><br>";

$message.="I plan to enter in the $semester of $year. <br>";

$message.="Please assist me in this matter.<br><br>";


$message.="B Munn<br>";

$subject="University - Inquiry Form";//The subject of the email is �University - Inquiry Form�

$headers = "MIME-Version: 1.0" . "\r\n";

$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

$headers .= "From: <therock691@gmail.com>" . "\r\n";//the email should like it was sent from the person contacting University




                Echo "Email sent successfully";


else //


                Echo "Error Occured while sending email";           


$hostname = "localhost";

$username = "vde_bmunn";

$password = "s0123456";

$database = "bmunn";

$table = "inquiry";

mysql_connect($hostname, $username, $password) or die("Unable to connect to database");

mysql_select_db($database) or die ("Unable to select db");

$fields = "id, name, address, city, state, zip, phone, email, major, semester year";

$values = "'$id', '$name', '$address', '$city', 'state', 'zip', 'phone', 'email', 'major'. 'semester', 'year'";

$query = "INSERT INTO $table ($fields) VALUES ($values)";

$result = mysql_query($query);


                echo "Thank you for completing the Inquiry Form";


                echo "Sorry, this is not currently working";




<a href='inquiry.html'>Go back to contact form</a></body>


HTML Document:

<!doctype html>



<meta charset="utf-8">

<title>Untitled Document</title>

<script type="text/javascript">

function MM_validateForm() { //v4.0

  if (document.getElementById){

    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;

    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);

      if (val) { nm=val.name; if ((val=val.value)!="") {

        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');

          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';

        } else if (test!='R') { num = parseFloat(val);

          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';

          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');

            min=test.substring(8,p); max=test.substring(p+1);

            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';

      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }

    } if (errors) alert('The following error(s) occurred:\n'+errors);

    document.MM_returnValue = (errors == '');

} }




<form action="inquiry.php" method="post" name="form1" id="form1">

  <h2>Niagara University Enrollment Form</h2>

  <table width="500" border="1">


      <td width="171"><label for="name">Name:</label></td>

      <td width="313"><input name="name" type="text" id="name" form="form1" title="name"></td>



                  <td width="171"><label for="name">Street Address:</label></td>

      <td width="313"><input type="text" name="address" id="address"></td>



                  <td width="171"><label for="name">City:</label></td>

      <td width="313"><input type="text" name="city" id="city"></td>



                  <td width="171"><label for="name">State:</label></td>

      <td width="313"><input type="text" name="state" id="state"></td>



                  <td width="171"><label for="name">Zip Code:</label></td>

      <td width="313"><input type="text" name="zip" id="zip"></td>



                  <td width="171"><label for="name">Telephone:</label></td>

      <td width="313"><input name="phone" type="text" id="phone" onBlur="MM_validateForm('name','','R','address','','R','city','','R','state','','R','zipcode','','RisNum','phone','','R','email','','RisEmail','major','','R');return document.MM_returnValue"></td>



                  <td width="171"><label for="name">Email Address:</label></td>

      <td width="313"><input type="text" name="email" id="email"></td>



                  <td width="171"><label for="name">Intended Major:</label></td>

      <td width="313"><input type="text" name="major" id="major"></td>







      <td><label for="select">Year:</label></td>

      <td><select name="year" id="year" >

        <option value="">Select Year</option>

          <option value="2014">2014</option>

          <option value="2015">2015</option>

          <option value="2016">2016</option>

          <option value="2017">2017</option>


        <label for="select3"></label>


      <td><label for="select">Semester:


      <td width="313"><select name="semester" id="semester"  title="semester">

        <option value="">Select Semester</option>

        <option value="Spring">Spring</option>

        <option value="Summer">Summer</option>

        <option value="Fall">Fall</option>

      </select>        </td>







                  <td width="171"><input name="submit" type="submit" id="submit" onClick="MM_validateForm('name','','R','address','','R','city','','R','state','','R','zip','','RisNum','phone','','R','email','','NisEmail','major','','R');return document.MM_returnValue" value="Submit"></td>






You are missing dollar signs for the correct variables in your $values

Can you be a little more specific about what works and what does not?

This is the message I get when I submit the form: Email sent successfully
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'vdevine'@'localhost' (using password: NO) in /home/vdevine/public_html/bmunn/php/inquiry.php on line 64
Unable to connect to database

Apparently it doesn't like your database credentials. Are you sure they are correct?

my database credentials are correct. In my first project I made a cotact form using html and php and the form worked correct. In my next project I made a database in putty that has all the same fields as my contact form. I'm not sure if my last step of adding the script in php to upload my sql information into the form is correct.Can you tell me if that information is correct and I will verify my user information again. Thanks

my database credentials are correct

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'vdevine'@'localhost' (using password: NO) in /home/vdevine/public_html/bmunn/php/inquiry.php on line 64

The above states otherwise.

Is the script correct then other than my credentials? This is what I get now:
Email sent successfullySorry, this is not currently working

Go back to contact form

Line 135 is faulty, as said before.