Jump to content

Can't go back to form in IE


Marfisa

Recommended Posts

I've got a little game running using PHP. It has a form to put in the correct answer. If you enter a wrong answer, it takes you to an error page and in Firefox you can either use the back button on your browser or the link to go back provided on the error page. But IE (at least IE6), trying either just gets you back to the error page and not the form to try again.

 

Is there anyway to get IE to get back to the main form page from a link like this javascript: history.go(-1)?

 

Here is my stripped down code-

<?php if(!isset($_POST['submit'])) { ?>

<form action="warped.php" method="post">
<input type="text" name="field1" size="20">
<input type="submit" value="Guess!" name="submit">
</form>

<?php } else{

if ($_POST['field1']==$warped_answer)
  { ?>

Stuff for correct answer goes here...

<? } else { include('_error.php'); } }

 

And _error.php contains this-

<h1>try again!</h1>

<p>
Oops, that's not the right answer!  Go <a href="javascript: history.go(-1)">back to the game</a> and try again.<br>
(If you're using IE, go <a href="index.php">back to the game list</a>.  The link above won't work for you.)
</p>

Link to comment
https://forums.phpfreaks.com/topic/122270-cant-go-back-to-form-in-ie/
Share on other sites

i think this is sorta what you want

might not be the best way to do it tho

<?php
if(!isset($_POST['submit'])) {
?>
<form action="warped.php" method="post">
<input type="text" name="field1" size="20" <?if (isset($_GET['field1'])){'value="'.$_GET['field1'].'"';}?>>
<input type="submit" value="Guess!" name="submit">
</form>
<?php
}else{
if ($_POST['field1']==$warped_answer)
{
?>

Stuff for correct answer goes here...

<?php } else {
print'<h1>try again!</h1>
<p>
Oops, that\'s not the right answer!  Go <a href="warped.php?field1='.$_POST['field1'].'">back to the game</a> and try again.
</p>';
}
}?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.