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
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>';
}
}?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.