Ok,hello everyone ! my first post on this forum and i hope you can help me (i know you can).
I have a pretty basic Contact form that i put together from couple of contact form samples found on the internet.There is some basic JavaScript which checks if all fields are entered correctly and if they are,it sends the email with a comment to my specified email address.The only problem is that at the end of the PHP code that sends the email,it brings up a new (blank,white) page with a basic link back to my index.html file (the user needs to click a link on that blank page to go back to the original website).
That is what i DONâT WANT in my php. i want my php to automaticly REDIRECT the user,after he clicks on âsendâ button to one spcialy made html page if the sending was successful and to another if it wasnât.
Is there a simple way to do it?
[php]<?php session_start();
if(isset($_POST[âsubmitâ])) {
$youremail = â[email protected]â;
$fromsubject = âwww.submesubyou.co.ccâ;
$name = $_POST[ânameâ];
$last_name = $_POST[âlast_nameâ];
$email = $_POST[âemailâ];
$subject = $_POST[âsubjectâ];
$message = $_POST[âmessageâ];
$to = $youremail;
$mailsubject = âMasage recived fromâ.$fromsubject.â Contact Pageâ;
$body = $fromsubject.â
The person that contacted you is '.$name.' '.$last_name.'
E-mail: '.$email.'
Subject: '.$subject.'
Message:
'.$message.'
|---------END MESSAGE----------|';
echo âThank you fo your feedback. I will contact you as soon as possible.
Go to Home Pageâ; /*want it changed so that it goes straight to the email_sent.html without need to click a link */
mail($to, $subject, $body);
} else {
echo âYou must write a message. Please go to Contact Pageâ; /*want it changed so that it goes straight to the email_not_sent.html without need to click a link */
}
?> [/php]