0

Me and my mate we're trying to solve this for over 1.5 hours, we are still getting the same and tried almost everything we could.

Could anyone help us do that?

This is error what we're getting:

PHP Parse error: syntax error, unexpected '}', expecting ',' or ';' in

And this is the code (line) it's happening on:

if(!isset($_POST['name'])) {echo"Please fill in a valid username"} else {$ok="$ok+1"}

It's PHP.

If anyone wants the full code here it is:

$ok=0;
if(isset($_POST['submit'])) {
if(!isset($_POST['name'])) {echo"Please fill in a valid username"} else {$ok="$ok+1"}
if(!isset($_POST['pass'])) {echo"Please fill in a valid password"} else {$ok="$ok+1"}

if($ok==2){
switch($_POST['name'],$_POST['pass']){
    case "FORAEROND","FORAEROND2":


    THIS IS THE TEXT THAT WILL SHOW IF USERNAME IS 'FORAEROND' AND PASSWROD IS 'FORAEROND2'


    break;



    /*case "FORAEROND5","FORAEROND6";        KEEP FOR LATER

    THIS IS THE TEXT THAT WILL SHOW IF USERNAME IS 'FORAEROND5' AND PASSWROD IS 'FORAEROND6'


    break;
    */

    }
  }
}

Thanks to everyone who will help. :)

EDIT:

We apologize to everyone, it was really stupid, somehow we deleted or forgot ';' behind the codes, this is really stupid and awkward.

aerond
  • 75
  • 1
  • 2
  • 8

3 Answers3

12

You missed ;. Each statement must ends up with a semicolon in PHP.

Ivan Velichko
  • 6,348
  • 6
  • 44
  • 90
5

You missed Semicolumn(;)

Replace

if(!isset($_POST['name'])) {echo"Please fill in a valid username"} else {$ok="$ok+1"}

with

if(!isset($_POST['name'])) {echo"Please fill in a valid username"; } else {$ok="$ok+1"; }
shubham715
  • 3,324
  • 1
  • 17
  • 27
3
$ok="$ok+1"

you forgot a semicolon here, it should be:

$ok="$ok+1";

same goes for the others

Lorence Hernandez
  • 1,189
  • 12
  • 23