ryeman98 Posted March 2, 2008 Share Posted March 2, 2008 I know, I know, we all hate IE but I made a Rock, Paper, Scissors game and it works fine and dandy in FF but breaks down in IE. The problem, the users guess won't submit. Any suggestions? Link to comment https://forums.phpfreaks.com/topic/93939-wont-work-in-ie/ Share on other sites More sharing options...
haku Posted March 2, 2008 Share Posted March 2, 2008 Yep, I suggest you either post a link or some code or preferably both, since we aren't magicians and can't tell you anything without seeing what you've done. Link to comment https://forums.phpfreaks.com/topic/93939-wont-work-in-ie/#findComment-481315 Share on other sites More sharing options...
ryeman98 Posted March 2, 2008 Author Share Posted March 2, 2008 Sorry about that, I kinda ran off too quick. <?php if ($_GET['act'] == "choose") { echo "<form action='rps.php?act=result' method='post'>"; echo "<table align='center' width='10%' border='0'><tr><td align='left'>"; echo "<input type='image' name='choice' value='rock' src='../images/rock.gif'>"; echo "<input type='image' name='choice' value='paper' src='../images/paper.gif'>"; echo "<input type='image' name='choice' value='scissors' src='../images/scissors.gif'>"; echo "</td></tr></table>"; echo "</form>"; } elseif ($_GET['act'] == "result") { $_SESSION['pageview'] = $_SESSION['pageview']+1; if ($_SESSION['pageview'] > 1) { echo "<a href='/rules.php'>No cheating!</a>"; } else { $user_choice = $_POST['choice']; $comp = array("rock", "paper", "scissors"); $rand_comp = rand(0, 2); $comp_choice = $comp[$rand_comp]; echo "You chose: ". $user_choice ."<br />"; echo "Comp chose: ". $comp_choice ."<br /><br />"; ?> As you can see, in IE ONLY, $user_choice is NULL. In Any other browser, it has what the user submitted. Link to comment https://forums.phpfreaks.com/topic/93939-wont-work-in-ie/#findComment-481407 Share on other sites More sharing options...
ryeman98 Posted March 2, 2008 Author Share Posted March 2, 2008 Bumping because it's still not fixed. Link to comment https://forums.phpfreaks.com/topic/93939-wont-work-in-ie/#findComment-481449 Share on other sites More sharing options...
tippy_102 Posted March 2, 2008 Share Posted March 2, 2008 Your form doesn't have a "submit" botton? Link to comment https://forums.phpfreaks.com/topic/93939-wont-work-in-ie/#findComment-481452 Share on other sites More sharing options...
ryeman98 Posted March 2, 2008 Author Share Posted March 2, 2008 The images are the submit buttons. Link to comment https://forums.phpfreaks.com/topic/93939-wont-work-in-ie/#findComment-481465 Share on other sites More sharing options...
AndyB Posted March 2, 2008 Share Posted March 2, 2008 This is all IE's fault. Ha Ha. This is a case where IE gets it right and other browsers do it wrong. When an image submit is clicked, it properly acts like an image map and returns the x and y co-ordinates of the clicked point relative to the upper-left corner of the image. If the image name is banana, then a POSTed form will provide the co-ordinates as $_POST['banana_x'] and $_POST['banana_y']. $_POST['banana'] will not exist. With multiple image submits each will, of course, need a different name not the same name and a different value. Link to comment https://forums.phpfreaks.com/topic/93939-wont-work-in-ie/#findComment-481531 Share on other sites More sharing options...
monkeybidz Posted March 2, 2008 Share Posted March 2, 2008 Try this: <?php if ($_GET['act'] == "choose") { echo "<form action='rps.php?act=result' method='post'>"; echo "<table align='center' width='10%' border='0'><tr><td align='left'>"; echo "<input type='image' name='choice' value='rock' src='../images/rock.gif'>"; echo "<input type='image' name='choice' value='paper' src='../images/paper.gif'>"; echo "<input type='image' name='choice' value='scissors' src='../images/scissors.gif'>"; echo "</td></tr></table>"; echo "</form>"; } elseif ($_GET['act'] == "result") { $_SESSION['pageview'] = $_SESSION['pageview']+1; } if ($_SESSION['pageview'] > 1) { echo "<a href='/rules.php'>No cheating!</a>"; } else { $user_choice = $_POST['choice']; $comp = array("rock", "paper", "scissors"); $rand_comp = rand(0, 2); $comp_choice = $comp[$rand_comp]; echo "You chose: ". $user_choice ."<br />"; echo "Comp chose: ". $comp_choice ."<br /><br />"; ?> Link to comment https://forums.phpfreaks.com/topic/93939-wont-work-in-ie/#findComment-481550 Share on other sites More sharing options...
PFMaBiSmAd Posted March 2, 2008 Share Posted March 2, 2008 monkeybidz, just posting random code without stating what you changed or fixed in it does not help the OP now, nor anyone that happens to find the thread in the future with the same problem. AndyB's post address the actual problem with the code. Also see this in the php manual - http://www.php.net/manual/en/faq.html.php#faq.html.form-image Link to comment https://forums.phpfreaks.com/topic/93939-wont-work-in-ie/#findComment-481702 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.