Search code examples
phpif-statementparse-error

PHP Parse Error: Missing a ; in if statement?


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?


Solution

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

    For example:

    echo '<hr><br />';