window.location error

Good morning. After the user submits their contact form and receives the alert box, I am wanting window.location to direct them to a different page. The rest of the script works great. I thought this was a simple process, but I am missing something.

Do you know what that is?

David


<?php $field_name = $_POST['cf_name']; $field_email = $_POST['cf_email']; $field_message = $_POST['cf_message']; $mail_to = '[email protected]'; $subject = 'Message from a site visitor '.$field_name; $body_message = 'From: '.$field_name."\n"; $body_message .= 'E-mail: '.$field_email."\n"; $body_message .= 'Message: '.$field_message; $headers = 'From: '.$field_email."\r\n"; $headers .= 'Reply-To: '.$field_email."\r\n"; $mail_status = mail($mail_to, $subject, $body_message, $headers); if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
	alert('Thank you for the message. If you entered your email correctly, I will contact you shortly.');
	window.location = ‘http://www.typingcoach.com';
</script>
<?php } else { ?>
<script language="javascript" type="text/javascript">
	alert('Message failed. Please, send an email to [email protected]’);
	window.location = 'contact.html';
</script>
<?php } ?>

You have two different quotes. That might be your problem

window.location = [size=18pt]‘[/size]http://www.typingcoach.com[size=18pt]’[/size];

Same here:

alert([size=18pt]’[/size]Message failed. Please, send an email to [email protected][size=18pt]’[/size]);

Sponsor our Newsletter | Privacy Policy | Terms of Service