Note that there are some explanatory texts on larger screens.

plurals
  1. POAJAX POST to PHP mySQL query
    primarykey
    data
    text
    <p>I am getting the proper log in the console but it isn't going to the database I cannot see anything wrong with my PHP, though. Can anyone see what might be the problem?</p> <p>JQuery code:</p> <pre><code> $( "#dialog-form" ).dialog({ autoOpen: false, height: 300, width: 350, modal: true, buttons: { "Create an account": function() { var fname = $( "#guestfname" ).val(); var lname = $( "#guestlname" ).val(); var gender = $( "#guestgender" ).val(); var address = $( "#guestaddress" ).val(); var city = $( "#guestcity" ).val(); var state = $( "#gueststate" ).val(); var zip = $( "#guestzip" ).val(); var phone = $( "#guestphone" ).val(); var email = $( "#guestemail" ).val(); var dob = $( "#guestdob" ).val(); var dataString ={fname:fname, lname:lname, gender:gender, address:address, city:city, state:state, zip:zip, phone:phone, email:email, dob:dob}; console.log(dataString); $.ajax({ type: "POST", url: "classes/add_guest.php", data: dataString, cache: false, success: function(html) { $('.guestinfo').html(html); } }); $( this ).dialog( "close" ); }, Cancel: function() { $( this ).dialog( "close" ); } }, close: function() { } }); $( "#create-user" ) .button() .click(function() { $( "#dialog-form" ).dialog( "open" ); }); }); </code></pre> <p>PHP mySQL query code:</p> <pre><code>&lt;?php //open connection require_once('../config/db.php'); $con = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); //get date $fname = $_POST['fname']; $lname = $_POST['lname']; $gender = $_POST['gender']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $phone = $_POST['phone']; $email = $_POST['email']; $dob = $_POST['dob']; mysqli_query($con, 'INSERT INTO guests(fname, lname, gender, address, city, state, zip, phone, email, dob) VALUES("'.$fname.'","'.$lname.'","'.$gender.'","'.$address.'","'.$city.'","'.$state.'",'. $zip.','.$phone.',"'.$email.'",'.$dob.''); mysqli_close($con); ?&gt; </code></pre>
    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