Getting this error:
- Parse error: syntax error, unexpected ';' in D:\EasyPHP-DevServer-14.1VC9\websitestuff\www\php-form-processor.php on line 9
The code:
$value = ($_POST['formEnquiry']) ? ($_POST['formName']) ? ($_POST['formTitle']) : '';
Getting this error:
The code:
$value = ($_POST['formEnquiry']) ? ($_POST['formName']) ? ($_POST['formTitle']) : '';
You appear to be trying to use two ternary operators, yet are not specifying an "else clause" for the first one. Breaking the code down:
$value = ($_POST['formEnquiry'])
         ? ($_POST['formName'])
             ? ($_POST['formTitle'])
             : ''
         // You're missing a ':' (else) statement here, like
         : ''
;
Writing it as procedural code, it would look like this:
if ($_POST['formEnquiry']) {
    if ($_POST['formName']) {
        $value = $_POST['formTitle'];
    } else {
        $value = '';
    }
} else {
    // Because of the way an assignment through a ternary works,
    // there needs to be an else here, since you already wrote $value =
    // Without an else value, it would end up like $value = ;
    $value = '';
}
 
    
    Try this:
$value = ($_POST['formEnquiry']) ? ($_POST['formName']) ? ($_POST['formTitle']) : '' : '';
