Jump to content

PHP Email Form - How to make errors stop the email from sending


echs

Recommended Posts

As already mentioned for this

 

header('Location: thankyou.html');

 

to work, it need to be placed before any html output I.E.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Speedy Spares Australia</title><style type="text/css"> ....blah blah blah

http://www.w3schools.com/php/func_http_header.asp read first example CAREFULLY.

Edited by dsonesuk
  • Like 1
Link to comment
Share on other sites

Oh... so... before ANY html at all... even the head tags. Okay, so... will moving all of the main php code before the head tags on the page solve my issue? Or just the "header('Location: thankyou.html');"? Well I suppose it's not hard to try and see what happens...

Link to comment
Share on other sites

As already mentioned for this

 

header('Location: thankyou.html');

 

to work, it need to be placed before any html output I.E.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Speedy Spares Australia</title><style type="text/css"> ....blah blah blah

http://www.w3schools.com/php/func_http_header.asp read first example CAREFULLY.

You Sir, are a legend. It works! Sorry that I'm such a dunce and didn't quite grasp the specifics of what you meant. Thanks for having the patience to bear with me!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...