I’m setting up my comment form using PHP on my FLASH site. I’m running variables through the below code to make sure the form is filled out properly.
Here’s my problem, when the form is filled out by the guest the “submit” button is pressed. The email is sent to "bob@mysite.com" and a auto generated email is sent to the email the guest has entered. When the guest opens their email they get the email as SENDER "bob@mysite.com" ($adminaddress), what I would like is, the SENDER to be shown as “Bob’s Site”($sitename).
I’ve tried to change the variables below but the form does not work at all.
Is there a way of doing this while allowing the form to function? What do I need to change below in order to acheive this?
Thanks!!
<?
$adminaddress = "bob@mysite.com";
$siteaddress ="http://www.mysite.com";
$sitename = "Bob's Site";
//No need to change anything below ...
// Gets the date and time from your server
$date = date("m/d/Y H:i:s");
// Gets the IP Address
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);
// Gets the POST Headers - the Flash variables
$action = $HTTP_POST_VARS['action'] ;
$email = $HTTP_POST_VARS['email'] ;
$name = $HTTP_POST_VARS['name'] ;
$comments = $HTTP_POST_VARS['comments'] ;
//Process the form data!
// and send the information collected in the Flash form to Your nominated email address
if ($action == "send") {
//
mail ("$adminaddress","Info Request",
"A visitor at $sitename has left the following information
Name: $name
Email: $email
The visitor commented:
------------------------------
$comments
Logged Info :
------------------------------
Using: $HTTP_USER_AGENT
Hostname: $ip
IP address: $REMOTE_ADDR
Date/Time: $date","FROM:$adminaddress" ) ;
//This sends a confirmation to your visitor
mail ("$email","Thank You for visiting $sitename",
"Hi $name,
Thank you for your interest in $sitename!
We will respond to your inquiry as soon as possible.
Cheers,
$sitename
$siteaddress","FROM:$adminaddress") ;
//Confirmation is sent back to the Flash form that the process is complete
$sendresult = "Thank you. You will receive a confirmation email shortly.";
$send_answer = "answer=";
$send_answer .= rawurlencode($sendresult);
echo $send_answer;
} //
?>