Skip to content Skip to sidebar Skip to footer

Submit A Form And Refresh To The Bottom Of The Page

when submitting a form in php i am using: 'header('Location: contact.php');' to redirect back to the current page after hitting submit. However the form is at the bottom of the pag

Solution 1:

Yes, You can take a id to part of a page you want to return to and then return to it, see following code:

for example you want to return to bellow div:

<div id="bottom"></div>

your php code to redirect to this:

header('Location: contact.php#bottom');

Solution 2:

You could check if your page was the pre ious page with window.history and if so, scroll down with window.scroll to.

I really recommend to not to that and use AJAX

Post a Comment for "Submit A Form And Refresh To The Bottom Of The Page"