Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Edit or Replace this try/catch statement to work with the current PHT configuration
- include '../includes/db.inc.php';
- // Modify the If statement so the try only runs if the First Name field has been submitted AND the honeypot field is empty ''
- if (isset($_POST['myfname'])) {
- $myFName = $_POST['myfname'];
- $myTour = $_POST['tour'];
- $myLName = $_POST['mylname'];
- $myEmail = $_POST['myemail'];
- // If the if statement is true, save each form field value as a variable. These variable values will be used in the thank you page.
- // And run the try/catch to attempt to insert data in the database. Modify the INSERT statement to write all the form filed values (except the honeypot) to the database.
- try
- {
- $sql = 'INSERT INTO reservations SET
- tour = :tour,
- fname = :fname,
- lname = :lname,
- email = :email';
- $s = $pdo->prepare($sql);
- $s->bindValue(':tour', $myTour);
- $s->bindValue(':myfname', $myFName);
- $s->bindValue(':mylname', $myLName);
- $s->bindValue(':myemail', $myEmail);
- $s->execute();
- }
- catch (PDOException $e)
- {
- $error = 'Error adding submitted joke: ' . $e->getMessage();
- include '../includes/error.html.php';
- exit();
- }
- // load the thank you page after the INSERT runs
- include 'success.html.php';
- // Add an else to load the initial page if the initial (line 19) if statement is false
- } else {
- include 'reservations.html.php'; //Modify this to include the initial file for this folder
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement