Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>your html file should be simular to: </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="jquery-1.7.1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" &gt; $(document).ready(function(){ $("form#submit").submit(function() { // we want to store the values from the form input box, then send via ajax below var fname = $('#fname').attr('value'); var lname = $('#lname').attr('value'); $.ajax({ type: "POST", url: "ajax.php", data: "fname="+ fname +"&amp;amp; lname="+ lname, success: function(){ $('form#submit').hide(function(){$('div.success').fadeIn();}); } }); return false; }); }); &lt;/script&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=windows-1255"&gt; &lt;title&gt;Insert title here&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="submit" method="post"&gt; &lt;fieldset&gt;&lt;legend&gt;Enter Information&lt;/legend&gt; &lt;label for="fname"&gt;Client First Name:&lt;/label&gt; &lt;input id="fname" class="text" type="text" name="fname" size="20" /&gt; &lt;label for="lname"&gt;Client Last Name:&lt;/label&gt; &lt;input id="lname" class="text" type="text" name="lname" size="20" /&gt; &lt;button class="button positive"&gt; Add Client &lt;/button&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;div class="success" style="display: none;"&gt;Client has been added.&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and ajax.php</p> <pre><code>&lt;?php include ("../../inc/config.inc.php"); // CLIENT INFORMATION $fname = htmlspecialchars(trim($_POST['fname'])); $lname = htmlspecialchars(trim($_POST['lname'])); $addClient = "INSERT INTO clients (fname,lname) VALUES ('$fname','$lname')"; mysql_query($addClient) or die(mysql_error()); ?&gt; </code></pre> <p>I copy this code from [enter link description here][1]</p> <p>[1]: <a href="http://www.ryancoughlin.com/2008/11/04/use-jquery-to-submit-form/" rel="nofollow">http://www.ryancoughlin.com/2008/11/04/use-jquery-to-submit-form/</a> and I tested.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload