Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Majid Mokhtari
Majid Mokhtari
10,506 Points

I can't see the thank you message!

I included this code, but still I cant see the thank you message after sending the email, in other words after I fill the form on contact.php the following code doesnt send the status=thanks to the browser, also to mention that Its working on my local server and I see the thank you message, but not on real server! anybody know why?

<?php header("Location: contact.php?status=thanks"); exit; ?>

2 Answers

Tom Nulty
Tom Nulty
2,017 Points

Hi Majid,

I'm not completely sure why this isn't working for you but have you tried putting a "/" in front of the contact.php like this:

<?php header("Location: /contact.php?status=thanks"); exit; ?>

This will ensure that it starts at the root of the domain and then move on to contact.php

If that doesn't work you could try use an absolute URL. So on your server it would be something like:

<?php header("Location: http://www.example.com/contact.php?status=thanks"); exit; ?>

Let me know if that works for you,

Tom.

Majid Mokhtari
Majid Mokhtari
10,506 Points

No I tried both solutions you gave me and its still not working, here could please take a look again at contact.php?

http://codepen.io/majidmo64/pen/vLBKb