Mail Sent message in Process.php

Hi There,

Im currently having some difficulty editing a contact form.

In script.js, it is looking for the following line: if(msg==‘Mail sent’) {

[php]// Check to see if the mail was successfully sent
if(msg==‘Mail sent’) {

					// Update the loader to a check + message
					$('#sentConfirmMessage').html(formSuccess);
					
					//Change the main title
					$('#sentConfirmTitle').html(formSuccessTitle);
					
					//Display the info
					$('#sentConfirmMessage').fadeIn(1000);
					$('#sentConfirmTitle').fadeIn(1000);
					
					// Reinitialize the fields
					$('#contactForm #name').val('Name*');
					$('#contactForm #email').val('E-mail*');
					$('#contactForm #subject').val('Subject');
					$('#contactForm #message').val('Message*');
					
					// Fade out the contact from, then toggle the height
					$("#contactForm").animate({"opacity": "0"}, 1000);	
					$('#contactForm').delay(200).slideToggle("slow");
					
					//Fade in reload link
					$('#reload').fadeIn();	
					
					
					//Ensure new title is cufoned after sending
					Cufon.replace('h1#sentConfirmTitle');
					
					
				} else {
					$('#contactForm #formProgress').html(formError);
				}
				
				// Activate the submit button
				$('#contactForm #submit').attr("disabled", "");
			},
			error: function(ob,errStr) {
				$('#contactForm #formProgress').html(formError);
				
				// Activate the submit button
				$('#contactForm #submit').attr("disabled", "");
			}
		});
		
		return false;
});[/php]

In Setup.js I have the following:

[php]var formError=“Error sending mail, please try again!”
var formWarning =“Verify fields, and try again!”
var formSuccess =“Thanks, we got your mail and will get back to you as soon as possible!”
var formSuccessTitle =“Message sent!”
var formReload =“Send us a mail and we will get back to you as soon as possible.”
var formReloadTitle =“Got something to say…”[/php]

What is happening is that because I don’t have a piece of code that somehow ‘points out’ if(msg==‘Mail sent’) { in my process.php form (listed below)

It is automatically sending an error message even though the email is being sent.

What line of code would I need to put into my process.php form to change it? Please help? Someone?

[php]<?php
$emailTo = ‘[email protected]’;
$subject = ‘Online Inquiry’;
$name=$_REQUEST[‘name’];
$email=$_REQUEST[‘email’];
$msg=$_REQUEST[‘msg’];

$body = "Name: $name \n\nEmail: $email \n\nMessage: $msg";
$headers = 'From: '.$name.' <'.$email.'>' . "\r\n" . 'Reply-To: ' . $email;

mail($emailTo, $subject, $body, $headers);

?>[/php]

Any help would be greatly appreciated!

Kind Regards,

Shiffers

Is the JavaScript run on the same page as the Process.php (the user views Process.php which contains both the PHP and JavaScript code)?

How are you getting the value of msg? Is it from an AJAX request? In this case it may just be necessary to output the desired result:

[php]echo ‘Mail sent’;[/php]

to be honest i’m actually not sure - its off a web template, will try that though - hopefully it works, if not i’ll let you know and try give you some more details!

Thanks a lot!

Working perfectly!

Thanks a lot for your help :smiley:

Sponsor our Newsletter | Privacy Policy | Terms of Service