Hello
This is my first encounter with PHP, about which I know nothing!
I have a script, however, which seems to work and I can either attempt to expand it so that it deals with everything I wish to do, or try to translate it to ASP.
The script sends an email to the site visitor (having completed an online form):
<?
if(!empty($HTTP_POST_VARS['sender_mail']) || !empty($HTTP_POST_VARS['sender_message']) || !empty($HTTP_POST_VARS['sender_subject']) || !empty($HTTP_POST_VARS['sender_name']))
{
$to = "myEmail@yahoo.com";
$subject = stripslashes($HTTP_POST_VARS['sender_subject']);
$body = stripslashes($HTTP_POST_VARS['sender_message']);
$body .= "\n\n---------------------------\n";
$body .= "Mail sent by: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";
$header = "From: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";
$header .= "Reply-To: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";
$header .= "X-Mailer: PHP/" . phpversion() . "\n";
$header .= "X-Priority: 1";
if(@mail($to, $subject, $body, $header))
{
echo "output=sent";
} else {
echo "output=error";
}
} else {
echo "output=error";
}
?>
Instead of 'subject' (or, perhaps, in addition to subject), I would like it to contain 'country' as this is one of the fields I will have in my email form.
I also need the script to do a couple of other things:
I would like the script to send a copy of the message to the site visitor's own email address and Webmaster, (the latter being myEmail@yahoo.com) and to send it HTML formatted as in a list:
Name <--navy bold (followed by Joe Bloggs)
Email: <--navy bold (followed by whatever@whatever.com)
Country: <--navy bold (followed by UK/USA whatever)
Message: <--navy bold (followed by whatever the message is).
Then I wish this date to be stored in an MS Access database which I have.
I am sure PHP can do all of the above; I'm just not certain whether to stick with the little I know of ASP, or use this script, which I know works.
Many thanks.
Steve