Using a PHP script you may accept feedback
from your website visitors and get the results emailed to you. You can use the sample script and tweak it a bit to suit your requirements.
You would need to change the Email address in
the field $from to any Email address on the domain name on which you are
incorporating this script. For example, if your Domain Name is abc.com, then you would
define the From Email address as some-name@abc.com. This Email address
need not be existing on the Mail Server of abc.com, however, the domain name in the $from field has to be yours. You may use an Email address such as
Do_Not_reply@abc.com.
The value in the
$mailto field needs to be changed to
the Email
address, where email containing the data submitted through the form needs to be
delivered.
Once the visitor provides feedback, he/she can
then be re-directed to another page on your website. In order to achieve this, you
need to mention the path to the HTML file in the $file field in the
script. Alternately, you can display a message to the visitor thanking him/her
for the feedback. Such messages can be displayed in a new page like thanks.htm. Such a page can also contain other information as deemed
necessary.
Sample
Script
<?
$mailto="xyz@abc.com";
$file="thanks.htm";
$pcount=0;
$gcount=0;
$subject = "Mail from Enquiry Form";
$from="some-name@abc.com";
while (list($key,$val)=each($HTTP_POST_VARS))
{
$pstr = $pstr."$key : $val \n ";
++$pcount;
}
while (list($key,$val)=each($HTTP_GET_VARS))
{
$gstr = $gstr."$key : $val \n ";
++$gcount;
}
if ($pcount > $gcount)
{
$message_body=$pstr;
mail($mailto,$subject,$message_body,"From:".$from);
include("$file");
}
else
{
$message_body=$gstr;
mail($mailto,$subject,$message_body,"From:".$from);
include("$file");
}
?>