fezzik Posted October 16, 2006 Share Posted October 16, 2006 Is there an alternative command to use that will move you to a specific section of a page? I don't want to refresh the page using header() but would like to move the user to a specified location on the page. Basically I have a large form. When you encounter validation errors after submission I want to 'jump' the user to the specific section of the form where the error occured.Cheers,Fezzik Quote Link to comment Share on other sites More sharing options...
fert Posted October 16, 2006 Share Posted October 16, 2006 http://www.phpfreaks.com/quickcode/Redirect/532.php Quote Link to comment Share on other sites More sharing options...
Jenk Posted October 16, 2006 Share Posted October 16, 2006 You'll need Javascript to do the 'jumping' Quote Link to comment Share on other sites More sharing options...
xsist10 Posted October 16, 2006 Share Posted October 16, 2006 You could use page anchors and redirect to them based on the errors.[code]<!-- Do some fancy javascript to call the anchor instead of making them click on it --><a href="#anchor_name">Jump me to some place in the code</a><a name="anchor_name">Some place in the code</a>[/code] Quote Link to comment Share on other sites More sharing options...
fezzik Posted October 16, 2006 Author Share Posted October 16, 2006 Thanks for the responses! I was thinking javascript was the best route to take too. I just wanted to see if it could be easily accomplished with php. I did create a method that allows this functionality with php. I created session variables to hold the values of the form variables that were a result of the form submission. Once the validation encounters an error I redirect the user with the header() command but append the appropriate page link to the end of the url. (i.e. header(somewebpage.php#contactInfo)) This will redirect the user to the location of the error. Although the page is refreshed using the header() command all the user's form input is still displayed because it was preserved using session variables. Best,Fezzik Quote Link to comment 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.