gum1982 Posted December 7, 2009 Share Posted December 7, 2009 Hello i am not sure if this is a JavaScript question or a php question so sorry first. Here is my problem i have a survey which is really long so you have to scroll down the page right to the bottom after filling it out and then clicking submit, the survey scrolls all the way to the top again i really don't want this to happen. After it has been submited i want it to scroll dynamically to the bottom. here is some of my code. <FORM METHOD="post" ACTION="" id="check"> <table> //whole survey form here// </table> <table> <input type="submit" name="signup" id="submit_btn" value="" /> </table> if(isset($_POST[signup])){ /////////////////////////////////////////////////////////////////////////// echo "<script langauge=\"javascript\">alert(\"Thank you We've received your Business Check. We will get back to you shortly!\");</script>"; } How can i run some code after the alert to send the user to the bottom off the page can someone please tell me what is the best way to do this???? Quote Link to comment https://forums.phpfreaks.com/topic/184289-scrollto/ Share on other sites More sharing options...
aeroswat Posted December 7, 2009 Share Posted December 7, 2009 PHP only handles the server side of things. You want Javascript. You will get a better answer posting in the javascript forums Quote Link to comment https://forums.phpfreaks.com/topic/184289-scrollto/#findComment-972895 Share on other sites More sharing options...
gum1982 Posted December 7, 2009 Author Share Posted December 7, 2009 Ok thanks cheers for the reply. Quote Link to comment https://forums.phpfreaks.com/topic/184289-scrollto/#findComment-972896 Share on other sites More sharing options...
premiso Posted December 7, 2009 Share Posted December 7, 2009 Really it is an HTML question. You want to look into anchor tags an example of what you will need: <FORM METHOD="post" ACTION="#bottom" id="check"><table> //whole survey form here// </table> <table> <a name="bottom"></a> <input type="submit" name="signup" id="submit_btn" value="" /> </table> I believe that is how it would work, so when the form submits it will automatically scroll to that anchor tag (notice in the form action you have the #bottom). Quote Link to comment https://forums.phpfreaks.com/topic/184289-scrollto/#findComment-972900 Share on other sites More sharing options...
gum1982 Posted December 7, 2009 Author Share Posted December 7, 2009 Hey that did the job good for what i needed thanks premiso Quote Link to comment https://forums.phpfreaks.com/topic/184289-scrollto/#findComment-972902 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.