Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Test page</title>
- </head>
- <body>
- <?php
- // Checking if form has been posted
- if ($_POST) {
- // Email Address destination
- $to = "djr32@kent.ac.uk";
- // Email subject
- $subject = "Subject: ".$_POST["drop_menu"];
- // Email body
- $name = "Name: ".$_POST["name"];
- $email = "Email Address: ".$_POST["email"];
- $commentbox = "Message: ".$_POST["commentbox"];
- // Mailing
- if (mail($to, $subject, $name, $commentbox, $email)) {
- // Successfully sent
- header("Location: redirect.html");
- } else {
- // Failed
- echo('<h1 class="msg error">Email delivery failed…</h1>');
- }
- }
- ?>
- <!-- Form -->
- <form method="POST">
- <!-- Dropdown Menu-->
- Please select an option: <select name="drop_menu">
- <option value="dog">Dog</option>
- <option value="cat">Cat</option>
- <option value="duck">Duck</option>
- </select><br>
- Name: <input type="text" name="name" />
- <br>
- Email Address: <input type="text" name="email" /><br>
- Enter Message: <textarea id="commentbox" class="text" cols="86" rows ="20" name="commentbox" ></textarea>
- <!-- Send button-->
- <input type="submit" value="Send Form" />
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement