-3

There is an issue with line 12 (a comment showing the line is present). Apparently, there is an unexpected ';' (semi-colon) in that line. Though the only semicolon there is to close that specific line which is always needed before moving to the next line.

 <?php
// creating a master if to see if the submit button was pressed.
if (isset($_POST['signup-submit'])) {
// connecting to the database validation file in the same file.
  require 'dbh.inc.php';
  $username = $POST['username'];
  $email = $POST['email'];
  $password = $POST['password'];
  $repeatPassword = $POST['repeat_password'];
  //error handlers time!!
  if (!filter_var($email,FILTER_VALIDATE_EMAIL && !preg_match("/^[a-zA-Z0-9]*$/",$username)) {
    header("Location: ../signup.php?error=invalidemailusername");  //this is line 12 with the issue
    exit();
  }

  else if (!preg_match("/^[a-zA-Z0-9]*$/",$username)) {
    header("Location: ../signup.php?error=invalidusername&email=".$email);
    exit();
  }

Parse error: syntax error, unexpected ';' in (no file location for privacy)on line 12

Mayur Karmur
  • 2,119
  • 14
  • 35
photon
  • 5
  • 2
  • 3
    Hint: If you can't find an error on the line it's reported on, look in the lines *above* it. Another hint: Always take time to count parentheses. – Some programmer dude Aug 22 '19 at 10:48

1 Answers1

1

This:

if (!filter_var($email,FILTER_VALIDATE_EMAIL && !preg_match("/^[a-zA-Z0-9]*$/",$username)) {

Should be this:

if (!filter_var($email,FILTER_VALIDATE_EMAIL) && !preg_match("/^[a-zA-Z0-9]*$/",$username)) {
Jeffrey Kastner
  • 651
  • 6
  • 15
  • Thanks a lot! that fixed the issue! this is my first time asking a question here, absolutely loving the community so far! Thanks again! – photon Aug 22 '19 at 11:09