XCalibre1 Posted March 22, 2023 Share Posted March 22, 2023 (edited) 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 March 22, 2023 by XCalibre1 Quote Link to comment https://forums.phpfreaks.com/topic/316028-php-prepared-statements-into-script/ Share on other sites More sharing options...
ginerjm Posted March 22, 2023 Share Posted March 22, 2023 You seem to be using two different languages here. Quote Link to comment https://forums.phpfreaks.com/topic/316028-php-prepared-statements-into-script/#findComment-1606712 Share on other sites More sharing options...
XCalibre1 Posted March 22, 2023 Author Share Posted March 22, 2023 I decided to go with just one language, as I don't know Javasript well enough. Thank you for your response. Quote Link to comment https://forums.phpfreaks.com/topic/316028-php-prepared-statements-into-script/#findComment-1606714 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.