derekunderwood01
New member
Hi guys/girls..
I'm currently trying to send an html form to email via .php. Basically I have standard html form that, when the user clicks a submit button it parses the information entered into the form to a php script that then sends the data to an email address via a 'mail' script (i.e. mail('[email protected]',$subject,$message,$header)
. Currently I have the form set up so that it echos true or false depending on whether the php was successful in sending or not.. this works fine...
The problem I am having is that, firstly, I do not want to leave the form page when the user clicks submit, and secondly I want to display success or failure (echo) message as a message in my html page, once the php has executed. I have been looking all over for days on how to get the echo value back into the html page with the form, so that I can call a javascript function to display a message to the user, but cannot seem to find it anywhere..
Can anyone please help here? Many thanks in advance..
Hi Chris, Thanks for your response.
Currently I have the for set up so that its sending.. let me give you a break down of exactly what i'm doing/want to do..
1. user fills out form on site, clicks submit
2. I'm using a bit of javascript at the top of the html page to check that all fields are filled in - if not, a message is displayed in a text box below the form, if it is the javascript sends the form to the php script like so:
var phpValidator = 'send_contact.php'
document.getElementById("myform").action = phpValidator;
3. the php script receives the form, and sends the variables via the following script:
$send_contact=mail($to,$subject,$message,$header);
4. The php script then checks that the form has sent and echos the response:
if($send_contact){
echo "We've recived your contact information, and will get back to you shortly";
}
else {
echo "There appears to be a problem sending at the moment, please try again later.";
}
5. All this is working fine, the email is sendi
5. All this is working fine, the email is sending - i dont actually want to change anything. All I actually need is a way of getting the echo back into the javascript (at the top of the html page that called it), and then displaying a success or failure message in an html text box on the form page - as opposed to redirecting the user.
Is any of this making sense?
Cheers,
D.
p.s. Your forgot to add your email address..
I'm currently trying to send an html form to email via .php. Basically I have standard html form that, when the user clicks a submit button it parses the information entered into the form to a php script that then sends the data to an email address via a 'mail' script (i.e. mail('[email protected]',$subject,$message,$header)

The problem I am having is that, firstly, I do not want to leave the form page when the user clicks submit, and secondly I want to display success or failure (echo) message as a message in my html page, once the php has executed. I have been looking all over for days on how to get the echo value back into the html page with the form, so that I can call a javascript function to display a message to the user, but cannot seem to find it anywhere..
Can anyone please help here? Many thanks in advance..

Hi Chris, Thanks for your response.
Currently I have the for set up so that its sending.. let me give you a break down of exactly what i'm doing/want to do..
1. user fills out form on site, clicks submit
2. I'm using a bit of javascript at the top of the html page to check that all fields are filled in - if not, a message is displayed in a text box below the form, if it is the javascript sends the form to the php script like so:
var phpValidator = 'send_contact.php'
document.getElementById("myform").action = phpValidator;
3. the php script receives the form, and sends the variables via the following script:
$send_contact=mail($to,$subject,$message,$header);
4. The php script then checks that the form has sent and echos the response:
if($send_contact){
echo "We've recived your contact information, and will get back to you shortly";
}
else {
echo "There appears to be a problem sending at the moment, please try again later.";
}
5. All this is working fine, the email is sendi
5. All this is working fine, the email is sending - i dont actually want to change anything. All I actually need is a way of getting the echo back into the javascript (at the top of the html page that called it), and then displaying a success or failure message in an html text box on the form page - as opposed to redirecting the user.
Is any of this making sense?
Cheers,
D.
p.s. Your forgot to add your email address..