0

I got this error when I was running some code:

Parse error: syntax error, unexpected T_IF, expecting ',' or ';' in C:\xampp\htdocs\scanner\mine.php on line 31

Line 31 is:

      if($_POST['thename']) {

I'm getting it from:

  echo '<h6>Settings</h6>';
  echo '<form action="" method="post">';
  echo '<b>Name:</b> <input type="text" name="thename" />';
  echo '<br /><input type="submit" value="Submit" />';
  echo '<hr><br />'

What's causing the parse error?

2
  • 2
    Look at the line of code above the if statement. Commented Jul 13, 2011 at 1:26
  • 1
    Oh wow, I'm an idiot. Thanks guys, I did leave out the semi-colon. Commented Jul 13, 2011 at 1:34

2 Answers 2

5

This is typically because the line above is missing an ending semi-colon.

For example:

echo '<hr><br />';
Sign up to request clarification or add additional context in comments.

Comments

3

Likely you left out a semicolon on the previous line, making php think that there was something more to the previous line and not expect an if statement.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.