Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Contact Form
- // Use in index.html or index.php or where do you need to show contact form paste there
- <form action="form.php" method="post" enctype="multipart/form-data">
- <h1 class="title">Contact</h1>
- <label>Name</label>
- <input name="name" required="required" placeholder="Your Name">
- <label>Email Address</label>
- <input name="email" type="email" required="required" placeholder="Your Email">
- <label>Comment</label>
- <textarea name="message" cols="20" rows="5" required="required" placeholder="Message"></textarea>
- <input id="submit" name="submit" type="submit" value="Submit">
- </form>
- // form.php (make a file name form.php)
- <?php
- $name = $_POST['name'];
- $email = $_POST['email'];
- $message = $_POST['message'];
- $from = 'From: YourWebsite.com';
- $to = '[email protected]';
- $subject = 'Email Inquiry';
- $body = "From: $name\n E-Mail: $email\n Message:\n $message";
- ?>
- <?php
- if ($_POST['submit']) {
- if (mail ($to, $subject, $body, $from)) {
- echo '<p>Thank you for your email!</p>';
- } else {
- echo '<p>Oops! An error occurred. Try sending your message again.</p>';
- }
- }
- ?>
- // you can get more information from here http://pageaffairs.com/notebook/php-contact-form
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement