Jump to content

php prepared statements into script?


XCalibre1

Recommended Posts

Is it possible to take:

      $name = $_POST['name'];
      $email = $_POST['email'];
      $phone = $_POST['phone'];
      $divebefore = $_POST['divebefore'];
      $HowMany = $_POST['party'];

      $mysqli = new mysqli('localhost', 'root', '', 'scuba');
      $stmt = $mysqli->prepare("INSERT INTO bookings (name, email, phone, divebefore, HowMany, date) VALUES (?,?,?,?,?,?)");
      $stmt->bind_param('ssssss', $name, $email, $phone, $divebefore, $HowMany, $date);
      $stmt->execute();
      $msg = "<div class='alert alert-success'>Booking Successfull</div>";
      $stmt->close();
      $mysqli->close();

 

and then add it to this script

 

if(return_data=='OK'){
    $('#display_msg').html('Validation is ok')
}else{
    reload();
$('#display_msg').html('Validation failed')
}
$("#display_msg").show();
setTimeout(function() { $("#display_msg").fadeOut('slow'); }, 3000);
});

 

Right after the validation is ok.....  With the form button below that would send it.

 

<Form type=post action=captcha-demo-data.php id=f1><input type=text name=t1 id=t1>
<img src=captcha-image-adv.php id="capt"><input type=button id='reload' value='Reload image'><input type=button id=b1 value=Submit></form>
<div id=display_msg></div>


With all of this being on one page.

basically I want the sql inserted into the database using javascript when they have the captcha correct.

Edited by XCalibre1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.