BrighteyesDesign
asked on
Show sucees message on the same page as the form
I have an enquiry form that sends using a separate php script. When the forms sends a success message displays on a blank page. How can I get this message to display on the page with the actual form?
This is the part of the php script that deals with the success message
This is the part of the php script that deals with the success message
// now we just send the message
if (@mail($to, $subject, $message, $headers)) {
echo "Thanks for sending your details. We will be in touch soon.";
} else {
echo "Failed to send";
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfectly clear, thanks!
You should enclose the code of the separate script in a function you pass parameters to
and make this function return true or false. Based on this you should display the message in your original page.
Cheers