title: Write form data to MySQL without page refresh
body: <p>I'm trying to create a page where when a button is clicked a form displays. Then I want the user to input information into that form and click a submit button. I want this information to be submitted to a MySQL database without refreshing/leaving this page.</p>
  
  <p>I've searched the internet and it seems like I have to use AJAX and jQuery to do this, but the problem is I don't know either of those at all. I've tried to follow examples and tutorials I've found on several sites, but I can't get any of them to work.</p>
  
  <p>I have the form created already. The code for it is below.</p>
  
  <pre><code>&lt;form name="classroom" method="post"&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;Enter New MCP Information&lt;/legend&gt;
          &lt;label for="date"&gt;Date:&lt;/label&gt;
          &lt;input type="text" size="26" name="date" value="yyyy-mm-dd" onclick="this.value=''"onfocus="this.select()" onblur="this.value=!this.value?'yyyy-mm-dd':this.value;"&gt;
  
          &lt;p&gt;     
              &lt;label for="objective"&gt;Objective:&lt;/label&gt;
              &lt;textarea name="objective" rows="3" cols="20" wrap="virtual"&gt;&lt;/textarea&gt;
          &lt;p&gt;
  
          &lt;label for="questions"&gt;Essential Questions:&lt;/label&gt;
          &lt;textarea name="questions" rows="2" cols="20" wrap="virtual"&gt;&lt;/textarea&gt;
  
          &lt;p&gt;     
              &lt;label for="criteria"&gt;Criteria for Success:&lt;/label&gt;
              &lt;textarea name="criteria" rows="2" cols="20" wrap="virtual" onclick="this.value=''"onfocus="this.select()"&gt;Must be separated by commas.&lt;/textarea&gt;
          &lt;p&gt;
  
          &lt;label for="agenda"&gt;Agenda:&lt;/label&gt;
          &lt;textarea name="agenda" rows="2" cols="20" wrap="virtual" onclick="this.value=''"onfocus="this.select()" &gt;Must be separated by commas.&lt;/textarea&gt;
  
          &lt;p class="submit"&gt;&lt;input type="submit" class="submit" value="Submit"&gt;&lt;/p&gt;
      &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The php script I'm using to write the form data is below. (I left out all the database connection and query info on purpose. It all works fine).</p>
  
  <pre><code>    &lt;?php
  
  $day=addslashes($_POST['date']);
  $objective=addslashes($_POST['objective']);
  $questions=addslashes($_POST['questions']);
  $criteria=addslashes($_POST['criteria']);
  $agenda=addslashes($_POST['agenda']);
  
  $connnect = mysql_connect("database","user","password");
          if (!$connnect)
          {
          die('Could not connect: ' . mysql_error());
          }
  
          mysql_select_db("databasename") or die(mysql_error());      
  
  mysql_query("INSERT INTO mcp (Date, TPO, Questions, Criteria, Agenda)
      VALUES ('$day', '$objective', '$questions', '$criteria', '$agenda')")
      or die(mysql_error()); 
  ?&gt;
  </code></pre>