Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP

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?

Thanks,

Joe

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!