I have the following code on files "a.php" and "b.php"
-----------------------------
FILE a.php
-----------------------------
<form action="a.php" method="post">
<input type="hidden" name="active" value="1">
<input type="submit" name="Submit" value="Send">
</form>
<?php
if (isset($_POST['active']) && $_POST['active'] == 1) {
?>
<script language="JavaS cript" type="text/JavaScript">
alert('Thank you.');
</script>
<?php ; } ?>
<a href="b.php">Go to b.php</a>
--------------------------
FILE b.php
--------------------------
<a href="#" onClick="histor y.back()">Back to a.php</a>
---------------------------
Works like this.
1. The user fills and sends the form in a.php
2. a.php loads and displays a thank you message
3. The user clicks on "Go to b.php"
4. b.php loads and the user clics on "Back to a.php"
5. a.php loads (I assume is loading from the cache") and displays thank
you message again, which should not occur!!!
I tried this on file a.php
<?php
if (isset($_POST['active']) && $_POST['active'] == 1) {
?>
<script language="JavaS cript" type="text/JavaScript">
if (!window.IWasHe re) {
alert('Thank you.');
var IWasHere = true;
}
</script>
<?php ; } ?>
But did not work. Also tried includding a pragma no-cache and expires
tags:
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
but did not work either.
Any ideas?
Thanks,
Guillermo Scharffenorth
-----------------------------
FILE a.php
-----------------------------
<form action="a.php" method="post">
<input type="hidden" name="active" value="1">
<input type="submit" name="Submit" value="Send">
</form>
<?php
if (isset($_POST['active']) && $_POST['active'] == 1) {
?>
<script language="JavaS cript" type="text/JavaScript">
alert('Thank you.');
</script>
<?php ; } ?>
<a href="b.php">Go to b.php</a>
--------------------------
FILE b.php
--------------------------
<a href="#" onClick="histor y.back()">Back to a.php</a>
---------------------------
Works like this.
1. The user fills and sends the form in a.php
2. a.php loads and displays a thank you message
3. The user clicks on "Go to b.php"
4. b.php loads and the user clics on "Back to a.php"
5. a.php loads (I assume is loading from the cache") and displays thank
you message again, which should not occur!!!
I tried this on file a.php
<?php
if (isset($_POST['active']) && $_POST['active'] == 1) {
?>
<script language="JavaS cript" type="text/JavaScript">
if (!window.IWasHe re) {
alert('Thank you.');
var IWasHere = true;
}
</script>
<?php ; } ?>
But did not work. Also tried includding a pragma no-cache and expires
tags:
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
but did not work either.
Any ideas?
Thanks,
Guillermo Scharffenorth
Comment