Every web site has email. Rather it being a feedback form of some sort or a mailto: tag, why make it hard for the visitor to contact you? When you can take 3 lines of code and create a feedback form the directly sends it to your email from the web browser with the visitor’s input.
Creating a PHP Email form could be the best thing that has ever happened to your site. So how do you do it? Easy.
You can have any one of your pages send an email when the visitor either visits the page or if the visitor has submitted some sort of input. When you add the code it needs to be at the top of the page you would like to send from.
Now let’s create feedback from scratch using HTML and PHP.
Create the following page with the following code.
<form method="post" action="sendmail.php">
To:<input type="text" name="mailto">
From: <input type="text" name="mailfrom">
Subject: <input type="text" name="subject"></p>
<area cols="20" rows="10" name="body"></area>
Now that we have created the feedback form with HTML, we are going to create the PHP code the actually sends the email to the user.
Create a new PHP page named sendmail.php and enter the following code on that page.
//->add this code to the top of the page
mail($mailto, $subject, $body
When a users access feedback.php and enter the email information and click submit the page will be redirected to sendmail.php which performs the send mail script. Brought to you by TECHSOFTCENTER.COM.