• 0

Contact box linked to email?


Question

Hello,

How do create a box for people to write in that sends the message to my email inbox?

Without it opening up outlook on click.

like the customer service ones you get on companies websites.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

http://www.w3schools.com/php/php_mail.asp

<html>
 <body>

<?php
 if (isset($_REQUEST['email']))
 //if "email" is filled out, send email
 {
 //send email
 $email = $_REQUEST['email'] ;
 $subject = $_REQUEST['subject'] ;
 $message = $_REQUEST['message'] ;
 mail( "someone@example.com", "Subject: $subject",
 $message, "From: $email" );
 echo "Thank you for using our mail form";
 }
 else
 //if "email" is not filled out, display the form
 {
 echo "<form method='post' action='mailform.php'>
 Email: <input name='email' type='text' /><br />
 Subject: <input name='subject' type='text' /><br />
 Message:<br />
 <textarea name='message' rows='15' cols='40'>
 </textarea><br />
 <input type='submit' />
 </form>";
 }
 ?>

</body>
 </html> 

Link to comment
Share on other sites

  • 0

Hmmm, ok...

1) Build a HTML form with a text box and a submit button that sends to itself

2) Inject some PHP into this page so that if it has a $_REQUEST variable set that corresponds with your form variables, it writes said data to the screen

3) Ammend the above so that if it has the specified variable, it doesn't render the form, but rather a thank you comment

4) Ammend the above so that it also sends an email

5) Ammend the above so that the content of that email is the value of the variable

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.