0

I recently installed wamp server to run some php, and I keep on getting this error: Parse error: syntax error, unexpected '{' in C:\wamp64\www\PHP\form-enquiries.php on line 18

I know my code is correct and I tested it on other servers and it worked just fine

Can anyone please tell me why its throwing this error?

    <?php
    if (strpos($cardtype, 'basic')){
        $price = 10;
    }
    else if (strpos($cardtype, 'medium')){
        $price = 15;
    }
    else (strpos($cardtype, 'high')){ //this is where it says the error is
$price = 20;
}

    ?>
  • 1
    Your `else (strpos...` is invalid, this should be `else {` or `else if(strpos...` – Nigel Ren Nov 16 '17 at 19:42
  • 1
    should that line be `else if` instead of just `else`? That code clearly has a syntax problem since else statements do not have a condition. – kmc059000 Nov 16 '17 at 19:43
  • Thank you! I realised I made a logical mistake. Would you like to make it an answer so I can accept it? – Coding nooby Nov 16 '17 at 21:34

0 Answers0