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 Build a Simple PHP Application Adding a Contact Form Working with Get Variables

Johnatan Guzman
PLUS
Johnatan Guzman
Courses Plus Student 2,360 Points

After submit, automatic focus on thank you message?

I am following along using my own website. I have a single website with multiple sections and the contact form is at the bottom. Everything works as it should be, but after submitting it refreshes the page and stays at the top. The message is shown if you scroll down, but is there a way so that it automatically scrolls down to my #contact section (after the refresh), to where the thank you message is displayed?

1 Answer

Give this a look and see it helps you out, without seeing your code it's not as easy, but this may send you in the right direction: http://stackoverflow.com/questions/22027170/automatically-scroll-down-after-submit-action

Basically, you are giving your form an ID and then in the action you are using it as an anchor.

Johnatan Guzman
Johnatan Guzman
Courses Plus Student 2,360 Points

Yes, it seems like that should do the trick, sadly it doesnt work for me :(

<form method="POST" id="form" action="index.php#form" novalidate="novalidate">