'Getting the error unexpected "{" [closed]
I am kind of embarraced asking this, but i keep getting the error unexpected "{"
<?php
$c = trim($_POST['cm']);
$inc = trim($_POST['inches']);
$resultat;
if (isset($c)) && (isset($inc)){
echo "string";
exit();
}
if(isset($c)){
echo "string";
exit();
}
if(isset($inc)){
echo "string";
exit();
}
?>
Im testing if both variables are empty, then im testing if one of them is empty ... but i keep getting a syntax error under every if statement ... cant see what i missed?
Solution 1:[1]
if (isset($c)) && (isset($inc)){
should be
if (isset($c) && isset($inc)){
Solution 2:[2]
Just one more bracket in if...
if ((isset($c)) && (isset($inc)){
echo "string";
exit();
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Stu |
| Solution 2 | xxx |
