Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>ALL</title>
- <meta charset="UTF-8">
- <link href="styles/recordsStyle.css" type "text/css" rel="stylesheet" />
- </head>
- <body>
- <h1>Records</h1>
- <br />
- <?php
- $theFirstName = $_POST["first_name"];
- $theLastName = $_POST["last_name"];
- $theWhatTown = $_POST["what_town"];
- $theWhatCounty = $_POST["what_county"];
- $theWhatMobile = $_POST["what_mobile"];
- $theWhatEmail = $_POST["what_email"];
- $theContactBy = $_POST["contact_by"];
- $theNewsletterSubscription = $_POST["newsletter_subscription"];
- $theAnyComments = $_POST["any_comments"];
- $dsn = 'mysql:host=mysql02host.comp.dkit.ie;dbname=YOUR D NUMBER';
- $username = 'YOUR D NUMBER';
- $password = 'YOUR SQL PASSWORD';
- try {
- $db = new PDO($dsn, $username, $password);
- } catch (PDOException $e) {
- $error_message = $e->getMessage();
- echo "<h1>DATABASE PROBLEM: " . $error_message . ".</h1>";
- exit();
- }
- $query = 'INSERT INTO table_records (firstName, lastName, whatTown, whatCounty, whatMobile, whatEmail, contactBy, newsletterSubscription, anyComments) VALUES (:theFirstName, :theLastName, :theWhatTown, :theWhatCounty, :theWhatMobile, :theWhatEmail, :theContactBy, :theNewsletterSubscription, :theAnyComments)';
- $statement = $db->prepare($query);
- $statement->bindValue(":theFirstName", $theFirstName);
- $statement->bindValue(":theLastName", $theLastName);
- $statement->bindValue(":theWhatTown", $theWhatTown);
- $statement->bindValue(":theWhatCounty", $theWhatCounty);
- $statement->bindValue(":theWhatMobile", $theWhatMobile);
- $statement->bindValue(":theWhatEmail", $theWhatEmail);
- $statement->bindValue(":theContactBy", $theContactBy);
- $statement->bindValue(":theNewsletterSubscription", $theNewsletterSubscription);
- $statement->bindValue(":theAnyComments", $theAnyComments);
- $statement->execute();
- $statement->closeCursor()
- ?>
- <table>
- <tr>
- <th>First Name</th>
- <th>Last Name</th>
- <th>Town</th>
- <th>County</th>
- <th>Mobile</th>
- <th>Email</th>
- <th>Contact By</th>
- <th>Newletter Subcription</th>
- <th>Any Comments/Questions</th>
- </tr>
- <tr>
- <td><?php echo $theFirstName; ?></td>
- <td><?php echo $theLastName; ?></td>
- <td><?php echo $theWhatTown; ?></td>
- <td><?php echo $theWhatCounty; ?></td>
- <td><?php echo $theWhatMobile; ?></td>
- <td><?php echo $theWhatEmail; ?></td>
- <td><?php echo $theContactBy; ?></td>
- <td><?php echo $theNewsletterSubscription; ?></td>
- <td><?php echo $theAnyComments; ?></td>
- </tr>
- </table>
- <br />
- <input type="button" onclick="window.location.href = 'index.html'" value="Home" />
- <br />
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement