But the error (line 40) is actually the last line...! :|


You had a missing brace. When the error line is the last line (and especially if error is Undefined $end) then you likely have a missing ending brace or ending quote. Not trying to start a flame war here, but if you try a different coding style you might have an easier time keeping track of open braces. The working code (in my own style :)):


<?php

// Verify User Input:
echo "<br><br><br>";
$requiredFields = array('Title',
                        'ChristianName',
                        'Surname',
                        'HomePhone',
                        'Address01',
                        'City',
                        'Post code',
                        'Country',
                        'Gender',
                        'WorkPermitRequired',
                        'MyStatus');
$errors = array();
foreach($requiredFields as $fieldName) {
  // If using post, change $_GET to $_POST instead
  // You can use $_REQUEST if you're unsure of GET/POST
  if (empty($_REQUEST[$fieldName])) {
    $errors[] = 'Required field "' . $fieldName . '" empty!';
  }
}
if (count($errors)) {
  echo "Sorry ";
  echo $_SESSION['UserCName'];
  echo "<br><br>";
  echo "The Following Fields Require Input ~ Please Go Back.";
  echo "<br><br>";
  foreach($errors as $error) {
    echo $error . '<br><br>';
  }
} else {
  echo "Hi...!";
}

?>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to