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

Johnatan Guzman
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">