Marfisa Posted September 1, 2008 Share Posted September 1, 2008 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 More sharing options...
slapdashgrim Posted September 1, 2008 Share Posted September 1, 2008 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 https://forums.phpfreaks.com/topic/122270-cant-go-back-to-form-in-ie/#findComment-631374 Share on other sites More sharing options...
Marfisa Posted September 2, 2008 Author Share Posted September 2, 2008 Unfortunately, that won't work, since the error page is linked from several similar games. I'd need a separate error message for each game. I need some generic way of going back. Link to comment https://forums.phpfreaks.com/topic/122270-cant-go-back-to-form-in-ie/#findComment-631550 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.