Jump to content

Browser History..


astralaaron
 Share

Recommended Posts

Say I have a simple forum type of program. User types a message, and clicks submit. The browser goes to the post.php page which just enters the data into the database, and then redirects the user to see their message.Is there any way, when they hit the post.php page, to not add the post.php page to the browser history? So if the user clicks the back button after being redirected they won't go back to the post.php page?

Link to comment
Share on other sites

Actually there is. Just write or include the post.php file in the same file as your form. And include a hidden value to let the page know that it has to store something:

<?php//processing:if(isset($_POST['submitPost'])){  //Proces the form posts}//Below is the output section with the pages posts <form action="vieuw.php">//The form also has the submitbuttom with name="submitForm"?>[code]However. Your post will not be included since processing happens on the same page as the output. After the processing, your script has to send a new header and after that it will include your post. Unfortunately when you press 'back' in your browser. It will probably ask you to send the posts again. The only way to prevent this is to make an AJAX object using php/javascript and send the data a-synchronously. There is much to read about AJAX on the w3schools website
Link to comment
Share on other sites

Actually there is. Just write or include the post.php file in the same file as your form. And include a hidden value to let the page know that it has to store something:
<?php//processing:if(isset($_POST['submitPost'])){  //Proces the form posts}//Below is the output section with the pages posts <form action="vieuw.php">//The form also has the submitbuttom with name="submitForm"?>[code]However. Your post will not be included since processing happens on the same page as the output. After the processing, your script has to send a new header and after that it will include your post. Unfortunately when you press 'back' in your browser. It will probably ask you to send the posts again. The only way to prevent this is to make an AJAX object using php/javascript and send the data a-synchronously. There is much to read about AJAX on the w3schools websitethanks, makes sense.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...