0

I have created a contact form for user to send their message.

When they click on "send" the data goes to my database and under the form I wanted to have a paragraph saying that the data are sends, so I proceeded like this:

<p25>sent succesfully! thanks<p25>

<?php
    echo "<script>setTimeout(\"location.href = 'no-sidebar.php';\",8000);</script>";
?>

When it's done the page is reloaded, it displays the part from above.

My problem is that I wanted it to stay in the section where my contact form can see the message.

Thanks for helping.

freedomn-m
  • 27,664
  • 8
  • 35
  • 57
salah tabet
  • 119
  • 1
  • 1
  • 10
  • Why would you want to reload at all? Just stay where you are. Use Ajax to send the data and receive the success message. Show it wherever you want. No reload required at all. – arkascha Dec 05 '15 at 17:33
  • Welcome to SO. Please read [What topics can I ask about](http://stackoverflow.com/help/on-topic) and [How to ask a good question](http://stackoverflow.com/help/how-to-ask) There is no way near enough information in this question for anything other than **guesses** – RiggsFolly Dec 05 '15 at 17:36
  • try this http://stackoverflow.com/questions/9757625/jquery-how-to-scroll-to-certain-anchor-div-on-page-load – Kishore Sahasranaman Dec 05 '15 at 17:36
  • thanks a lot , i am a beginner in coding, this is why – salah tabet Dec 05 '15 at 20:58

1 Answers1

0

You can use an anchor.

The HTML Anchor Element () defines a hyperlink to a location on the same page or any other page on the Web. It can also be used to create an anchor point — a destination for hyperlinks within the content of a page, so that links aren't limited to connecting simply to the top of a page.

<a href="#anchor"></a>
<p25>sent succesfully! thanks<p25>

<?php
    echo "<script>setTimeout(\"location.href = 'no-sidebar.php#anchor';\",8000);    </script>";
?>

Put the a href='#anchor' where you want the page to end up and #anchor in the url.

freedomn-m
  • 27,664
  • 8
  • 35
  • 57