I had this working until I had to add a check box to the form. Everything now works except the sql query. My jquery looks like this (php to follow)
var dataString = 'name=' + name + ' & email=' + email + ' & note=' + note + ' & news=' + news;
//alert (dataString);return false;
$.ajax({
type: "POST",
url: "form/process.php",
data: dataString,
success: function() {
$('#contact_form').html("<div id='message'></div>");
$('#message').html("<center><h2>This is what we're all about -<br /> here when you need us.</h2><p>We will be in touch with you as soon as possible.</p>")
//.append("")
.hide()
.fadeIn(1000, function() {
$('#message').append("<img src='images/logo_footer.png' />");
});
And the php form looks like:
<?php
//send email
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$note = $_REQUEST['note'] ;
$news = $_REQUEST['news']
$oncall = "On Call Legal Services";
$message = "From: $name\r\nEmail: $email\r\nNote: $note";
$rec_message = "Thank you $name for your interest in our services,\r\n We will be in touch with you momentaraly";
mail( "name@email.com", "Name: $name ", $message, "From: $email" );
$sql = "INSERT INTO `skwidge1_oncall`.`recipient` (`rec_name`, `rec_email`, `rec_note`, `rec_newsletter` ) VALUES ('$name', '$email', '$note', '$news')";
$query = mysqli_query($myConnection, $sql) or die (mysqli_error());
?>
For some reason the SQL is not getting inserted to the database and I feel like I am spending to much time gettng it to work. Any help is appreciated.