Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>AmeriCamp - Home</title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width">
- <meta name="keywords" content="AmeriCamp, camp in America, America camping">
- <meta name="description" content="AmeriCamp was founded on a dream to offer the highest salaries and lowest prices for people around the world who wanted to work at what people would refer to as “Camp America”.">
- <link rel="stylesheet" type="text/css" href="styles/americamp-styles.css">
- </head>
- <body>
- <table>
- <tr>
- <th>
- <a href="index.html">
- <img src="images/americamp.jpg" alt="logo" width="340" height="200">
- </a>
- </th>
- <!--Links to each page-->
- <th>
- <a href="index.html">Home</a>
- <a href="about.html">About</a>
- <a href="comment.php">Comment</a>
- <a href="gallery.html">Gallery</a>
- <a href="contact.html">Contact</a>
- </th>
- </tr>
- <tr>
- <td>
- <a href="https://www.americamp.co.uk/about/americamp-bloggers/" target="_blank">
- <img src="images/Check-out-our-AmeriCamp-Bloggers.jpg" width="340" height="400" alt="Check-out-our-AmeriCamp-Bloggers">
- </a>
- <h2>
- <b>Follow Us</b>
- <br>
- <br>
- <a href="https://www.facebook.com/AmeriCamp">
- <img src="images/fblogo.png" alt="Fb-logo" width="140" height="150">
- </a>
- <br>
- <br>
- <a href="https://www.instagram.com/americamp/">
- <img src="images/instalogo.png" alt="insta-logo">
- </a>
- <br>
- <br>
- <a href="https://twitter.com/americamp">
- <img src="images/twitterlogo.png" alt="twitter-logo">
- </a>
- <br>
- </h2>
- </td>
- <td class="boxes">
- <h3>Comment</h3>
- <b>AmeriCamp Mailing List</b>
- <h3>
- To think that this could be the start of a wonderful adventure! #FreeBiscuits x
- the world to do Summer Camp in America 2017 and has won many awards including Best Summer Camp America 2016 Organisation.
- </h3>
- <?php
- //Error section
- $nameE = $emailE = $genderE = "";
- //Variables
- $name = $email = $gender = $comment = "";
- //Name Section
- if ($_SERVER["REQUEST_METHOD"] == "POST") {
- {
- if(empty($_POST["name"])) {
- $nameE = "Name is required";
- }
- else
- {
- //checks if the name only contain letters and space.
- $name = test_input($_POST["name"]);
- if(!preg_match("[a-zA-Z]*$/^", $name)){
- $nameE = "Only letters and space required.";
- }
- //Email section
- if (empty($_POST["email"]))
- {
- $emailE = "Email is required.";
- }
- else
- {
- $email = test_input($_POST["email"]);
- //checks if email address is entered right.
- if(!filter_var($email, FILTER_VALIDATE_EMAIL))
- $emailE = "Invalid";
- }
- //Comment section
- if(!empty($_POST["comment"]))
- {
- $comment = test_input($_POST["comment"]);
- }
- //Gender section
- if(empty($_POST["gender"]))
- {
- $genderE = "Required";
- }
- else
- {
- $gender = test_input($_POST["gender"]);
- }
- }
- function test_input($data)
- {
- $data = trim($data);
- $data = stripslashes($data);
- $data = htmlspecialchars($data);
- return $data;
- }
- ?>
- <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
- Name:
- <input type="text" name="name">
- <span class="erorr">* <?php echo $nameE;?></span>
- <br><br>
- E-mail:
- <input type="text" name="email">
- <span class="error">* <?php echo $emailE;?></span>
- <br><br>
- Comment: <textarea name="comment" rows="5" cols="40"></textarea>
- <br><br>
- Gender:
- <input type="radio" name="gender" <?php if (isset($gender) && $gender=="female") echo "checked";?> value="female">Female
- <input type="radio" name="gender" <?php if (isset($gender) && $gender=="male") echo "checked";?> value="male">Male
- <span class="error">* <?php echo $genderE;?></span>
- <br><br>
- <input type="submit" name="submit" value="Submit">
- </form>
- <?php
- echo $name;
- echo "<br>";
- echo $email;
- echo "<br>";
- echo $comment;
- echo "<br>";
- echo $gender;
- ?>
- </td>
- </tr>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement