Hi all

I have a website that has a contact form in the footer of every page. When someone sumbits their details I do a check to see if the fields are filled in correctly. If the fields aren't filled in correctly I display an error just above the form.

The problem is that when the page loads after submit I need it to jump to the bottom of the page. I've put the following code just above the contact form:
<code=html><a name="contact"></a></code>

And I'm trying to use the following php code to jump to the bottom of the page:
<code=php>header("Location: ".$_SERVER."#contact");</code>

The problem is that #contact isn't being included in the redirect. How do I include it?

you could use javascript instead of the header()-function, that would we what i would use:

<script>document.location.href = "index.php#contact";</script>

that refreshes the page and scrolls down to the #contact

you could use javascript instead of the header()-function, that would we what i would use:

<script>document.location.href = "index.php#contact";</script>

that refreshes the page and scrolls down to the #contact

Thanks for your response Agarsia. I'm hoping for a php solution in order to avoid a situation where someone doesn't have javascript enabled. I know very few will have it turned off but I like having a solution that's 100% guaranteed.

Do your checking in the same script as the form display. Set your form action to "myformscript.php#contact" and relocate the user only after the form has successfully been submitted.

thinking out loud, whack in a ? mark like so:

header("Location: ".$_SERVER['PHP_SELF']."?#contact");

Thanks smantscheff...your solution did the trick ;)