Monday, August 5, 2019

forms - Parse error: syntax error, unexpected '(' in D:xampp3xampphtdocscontact.php on line 10




I have a problem with my code here.
I'm making a simple "Contact us" via html / PHP.
But i'm new to all this, and learning it from step to step. So thats why i've come here.
I get this error: Parse error: syntax error, unexpected '(' in D:\xampp3\xampp\htdocs\contact.php on line 10 and here is the code:



include 'core/init.php';
include 'includes/overall/header.php';
if (empty($_POST) === false) {

$name = $_POST ['name'];
$email = $_POST ['email'];
$message = $_POST ['message'];

if (empty($name) === true || (empty( ($email) === true || (empty($message === true) {
$errors[] = 'Name, email and message are required!';
} else {

}
?>


Answer



Try this:



include 'core/init.php';
include 'includes/overall/header.php';
if (empty($_POST) === false) {

$name = $_POST ['name'];
$email = $_POST ['email'];
$message = $_POST ['message'];

if (empty($name) === true || empty($email) === true || empty($message) === true) {
$errors[] = 'Name, email and message are required!';
} else {
}
// The else above is actually not needed thus you could remove it.

}
?>


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...