email me back form error !!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
swarnpalsingh89
Forum Newbie
Posts: 7
Joined: Tue Jul 07, 2009 4:37 am

email me back form error !!

Post by swarnpalsingh89 »

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>";

}

?>
User avatar
Jammerious
Forum Commoner
Posts: 59
Joined: Sat Jun 27, 2009 11:30 am
Location: Slovenia (EU)

Re: email me back form error !!

Post by Jammerious »

Hi,
exactly what seems to be the problem? You are not getting emails? Check your apache log file to see which error occurs.
swarnpalsingh89
Forum Newbie
Posts: 7
Joined: Tue Jul 07, 2009 4:37 am

Re: email me back form error !!

Post by swarnpalsingh89 »

there is no error , the php script displays that it has sent the email , but i dont get it
swarnpalsingh89
Forum Newbie
Posts: 7
Joined: Tue Jul 07, 2009 4:37 am

Re: email me back form error !!

Post by swarnpalsingh89 »

ok , i tried the same script on my friends server , there it worked fine , i guess i have to configure my server in some way , can u help me with that .
User avatar
Jammerious
Forum Commoner
Posts: 59
Joined: Sat Jun 27, 2009 11:30 am
Location: Slovenia (EU)

Re: email me back form error !!

Post by Jammerious »

You should google for instructions on how to set up sendmail (or whichever mailing agent you have) on your server configuration.
If you want someone here to help you need to be more "verbose" about your problem, like what server configuration you have.
You said there was no error, but I am not sure if you understood where to look: find your web server (ie. apache) error log file, it is sure to have something about this problem there. Google is your friend :)
Post Reply