email me back form error !!
Posted: Tue Jul 07, 2009 5:06 am
i have been trying to use this script to send me an email from my website , i used to work before , but it isnt working now , please help !!!
link to html page is http://www.vttravels.in/railnew.html
PLEASE HELP !!!
PHP SCRIPT :
<?php
$email = 'swarnpalsingh89@hotmail.com';
$subject = 'Railway Registeration';
$emailcheck = $_REQUEST['email'];
$message = "FROM : ".$_REQUEST['from']."\nTO : ".$_REQUEST['to1']."\nDATE : ".$_REQUEST['date1x']."\nAPPROX TIME : ".$_REQUEST['hrs']." ".$_REQUEST['mins']." ".$_REQUEST['meridian']."\nCLASS : ".$_REQUEST['class']."\nNO. OF TICKET : ".$_REQUEST['no_of_ticket']."\nDESCRIPTION : ".$_REQUEST['description']."\nNAME : ".$_REQUEST['name']."\nEMAIL : ".$emailcheck."\nPHONE : ".$_REQUEST['phone']."\nFAX : ".$_REQUEST['fax']."\nADDRESS : ".$_REQUEST['street']."\nCITY or STATE : ".$_REQUEST['city']."\nZIP : ".$_REQUEST['zip']."\nCountry : ".$_REQUEST['country'];
/* PHP form validation: the script checks that the Email field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $emailcheck)) {
echo "<h4>Invalid email address</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($subject == "") {
echo "<h4>No subject</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
}
/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
elseif (mail($email,$subject,$message)) {
echo "<h4>Thank you for sending email, Our representative will soon get in contact with you</h4>";
} else {
echo "<h4>Can't send email to $email</h4>";
}
?>
link to html page is http://www.vttravels.in/railnew.html
PLEASE HELP !!!
PHP SCRIPT :
<?php
$email = 'swarnpalsingh89@hotmail.com';
$subject = 'Railway Registeration';
$emailcheck = $_REQUEST['email'];
$message = "FROM : ".$_REQUEST['from']."\nTO : ".$_REQUEST['to1']."\nDATE : ".$_REQUEST['date1x']."\nAPPROX TIME : ".$_REQUEST['hrs']." ".$_REQUEST['mins']." ".$_REQUEST['meridian']."\nCLASS : ".$_REQUEST['class']."\nNO. OF TICKET : ".$_REQUEST['no_of_ticket']."\nDESCRIPTION : ".$_REQUEST['description']."\nNAME : ".$_REQUEST['name']."\nEMAIL : ".$emailcheck."\nPHONE : ".$_REQUEST['phone']."\nFAX : ".$_REQUEST['fax']."\nADDRESS : ".$_REQUEST['street']."\nCITY or STATE : ".$_REQUEST['city']."\nZIP : ".$_REQUEST['zip']."\nCountry : ".$_REQUEST['country'];
/* PHP form validation: the script checks that the Email field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $emailcheck)) {
echo "<h4>Invalid email address</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($subject == "") {
echo "<h4>No subject</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
}
/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
elseif (mail($email,$subject,$message)) {
echo "<h4>Thank you for sending email, Our representative will soon get in contact with you</h4>";
} else {
echo "<h4>Can't send email to $email</h4>";
}
?>