When I click BACK button on my Browser, all old variables were sent to URL are retrieved again. How can I destroy them?


Recommended Answers

All 7 Replies

As far as I know it isn't possible to removes ones url history but perhaps you should consider $_POST. Then the user will need to confirm the post request and if they do you should then get the server to check if the same post request has been sent in the last 48 hours. Mysql or maybe even sessions could help you there. If you could post some code then I will help you implement these features.

I have 5 combo boxes and I use OnChange event not to use 5 submit buttons or 5 different pages to process selections because each selections populate data to next combo. I use one Submit button to finalise the process. I didn't want to use any button for selections.

<select name='select' onChange='window.location.href=this.value'>
<option value='?intID=$intID&intD=$intD'>$intDate</option>

this is an interesting thread... im also curios if you there is a way on solving that problem coz. the back button is specially made for that... for viewing your previously viewed page. i dont know if there's really a code for that.. i dont know... maybe?

Try placing this at the top of each page.

if (!empty($_GET)) {
for ($i=0;$i<count($_SESSION['GET']);$i++) {
    if ($_SESSION['GET'][$i]==$_GET) {
        die('This page has already been viewed.');

Instead of sending header and URL to current page to be process variables, I send it to other page to process URL variables and redirect back to actual page. If anyone click BACK button, no error would be generated in this way. I simply don't deal with variables in same page anymore. It is better.


<select name='select' onChange='window.location.href=this.value'><option value='otherpage.php?intID=$intID&intD=$intD'>$intDate</option></select>


......some code
$_SESSION["intID"] = $_GET["intID"];
$_SESSION["intD"] = $_GET["intD"];

So is it solved?

:) Clever

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.