Jump to content

PHP HELP


driz
 Share

Recommended Posts

Good god.This line:if($_POST["submit"] !="submit")should probably be this:if (isset($_POST['submit']))..since you're trying to use $_POST information in that block.And I'm not sure what you're doing here:$words = file("words.txt");$word = $words[rand(0,2)];$word = $_POST['word'];If you're just going to set $word to be the value from $_POST['word'], why do you bother with the text file?This line:$guessLetter = $_POST["guess"] . "";Doesn't match anything in $_POST, there's nothing called "guess".I have no idea what you're trying to do with this line, but it's wrong all sorts of ways:$blank($i="_"i)$blank isn't a function, you're trying to use it as a function with the parentheses. It looks like you're trying to assign some sort of value to $i (which is the loop iterator), but "_"i isn't a valid expression in PHP. The line also doesn't have a semicolon after it. The entire for loop doesn't make sense:for($i=0;$i<strlen($blank);i++){ $blank($i="_"i) $compare=stripos($word,$guessLetter);}You're looping once for however many characters are in $blank, which is the same value as $word. Like I said I've got no idea what you're trying to do with the first line, and the second line doesn't use the loop iterator at all, you're just checking if $guessLetter is inside $word, but you do that check several times since you put it in a loop for whatever reason.This line:if($compare === FALSE) ! = FALSE || &compare === 0)just sort of leaves me speechless. There are at least 3 errors in that line. Again, I don't know what you're trying to accomplish with it.This.. "block":$wrongGuess{ if($compare ! = FALSE $blank[$compare] = $word[$compare];}is also pretty amusing. You just have a variable on it's own line (without a semicolon), which doesn't do anything, then you start a scope block, you have an if statement that leaves out a paren, and then you set a character in one variable to match the same character in the other variable. But the two variables already have the same value anyway.This line is missing a couple quotes and an equal sign:print("<img src\"hangman-\" . $wrongGuess . \".png\" />";This line uses a bitwise operator instead of a boolean operator:if($wrongGuess <6 | $finish == 0)And this line doesn't even finish: <input type="hidden"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...