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


Joe Li
Joe Li
8,104 Points

How to re-direct to id within same page

Hey Guys,

After sending a form I want to redirect to the same page and display a thank you message. The problem is it's a one pager website so the form I want to redirect to is at the bottom. The thank you message is displaying but you have to scroll down to see it.

What's the best method to achieve this?

I tried:

header('Location: ../index.php#section6?status=thanks');

But that didn't work! Any suggestions?



2 Answers

Tobias Schulz
Tobias Schulz
1,997 Points

Did u tried a absolute url and changed the order of your parameters?

Something like that:

header('Location: http://www.mypage.com/index.php?status=thanks#section6');

Joe Li
Joe Li
8,104 Points

It works perfect thanks!