JackJack Posted March 31, 2006 Share Posted March 31, 2006 When I Upload It And Try It Out It Doesnt Work. When I click the image It Doesn't do Anything.Plz HelpThank You<?php$computer = rand(1,3);{if ($computer == 1) $choice = 'rock' ;if ($computer == 2) $choice = 'paper' ;if ($computer == 3) $choice = 'scissors' ;}$action = $_POST[action];if ($action == 'rock' && $choice == 'rock') {echo "No One Wins";exit; }if ($action == 'rock' && $choice == 'paper') {echo "You Lose";exit; }if ($action == 'rock' && $choice == 'scissors') {echo "You Win";exit; }if ($action == 'paper' && $choice == 'rock') {echo "You Win";exit; }if ($action == 'paper' && $choice == 'scissors') {echo "You Lose";exit; }if ($action == 'paper' && $choice == 'paper') {echo "No One Wins";exit; }if ($action == 'scissors' && $choice == 'rock') {echo "You Losed";exit; }if ($action == 'scissors' && $choice == 'paper') {echo "You Win";exit; }if ($action == 'scissors' && $choice == 'scissors') {echo "No One Wins";exit; }?><html><a href='http://www.battlemachines.net/test/rps.php?action=rock'><img src='http://www.battlemachines.net/test/rock.bmp'></a><br><a href='http://www.battlemachines.net/test/rps.php?action=paper'><img src='http://www.battlemachines.net/test/paper.bmp'></a><br><a href='http://www.battlemachines.net/test/rps.php?action=scissors'><img src='http://www.battlemachines.net/test/scissors.bmp'></a></html> Quote Link to comment Share on other sites More sharing options...
AndyB Posted March 31, 2006 Share Posted March 31, 2006 When a parameter if passed via URL (as yours is), the passed values are in the [b]GET[/b] array. Change:[code]$action = $_POST[action];[/code]to this:[code]$action = $_GET['action'];[/code] Quote Link to comment Share on other sites More sharing options...
JackJack Posted March 31, 2006 Author Share Posted March 31, 2006 Thank You Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.