Just trying to get a very simple form working
Getting a
Parse error: syntax error, unexpected T_IS_EQUAL on line 10

<?php
$to = "";
$subject = "Contact Us";
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$embody = "Name: $name\nEmail: $email\nSuggestion: $message" ;
$sent = mail($to, $subject, $embody, $headers) ;
if($name || $email || $message) == "" {
	echo "You seem to have left something out. Please fill in all the fields and try again.<br /><br /><a href=\"javascript:closeWindow();\">Close</a>"; }
else
if($sent)
	{echo "Thank you $name, your mail has been sent successfully with the message of:<br /><br /><i>$message</i><br /><br /><a href=\"javascript:closeWindow();\">Close</a>"; }
else
	{echo "We encountered an error sending your mail<br /><br /><a href=\"javascript:closeWindow();\">Close</a>"; }
?>

I know its something with the checking if the fields are blank, but I can't find what
Thanks

Just trying to get a very simple form working
Getting a
Parse error: syntax error, unexpected T_IS_EQUAL on line 10

<?php
$to = "";
$subject = "Contact Us";
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$embody = "Name: $name\nEmail: $email\nSuggestion: $message" ;
$sent = mail($to, $subject, $embody, $headers) ;
if($name || $email || $message) == "" {
	echo "You seem to have left something out. Please fill in all the fields and try again.<br /><br /><a href=\"javascript:closeWindow();\">Close</a>"; }
else
if($sent)
	{echo "Thank you $name, your mail has been sent successfully with the message of:<br /><br /><i>$message</i><br /><br /><a href=\"javascript:closeWindow();\">Close</a>"; }
else
	{echo "We encountered an error sending your mail<br /><br /><a href=\"javascript:closeWindow();\">Close</a>"; }
?>

I know its something with the checking if the fields are blank, but I can't find what
Thanks

In the above code you forgot to put

braces for the if statement, try the following

if(($name || $email || $message) == "")


Thanks & Regards
Sai Prem
<snipped>

In the above code you forgot to put

braces for the if statement, try the following

if(($name || $email || $message) == "")

That fixed the error, but now I am getting the "You seem to have left something out. P..." all the time even when everything is filled in.

If you are doing it from local environment, the mail sending will not works for you. You need to set the smtp address and port number in the php.ini file

It all works fine and I get the form mail through to my email inbox. Everything is ok, I just wish to check the boxes are not blank

Try changing if($name || $email || $message) == "" to if(empty($name)||empty($mail)||empty($message)) { } The preferred method of checking whether or not a variable is empty is with the empty() function ( [i]bool[/i] [b]empty[/b] ( [i]mixed[/i] $var ) ).
The OR operator (||) doesn't work quite the way you used it above.
You also left out a closing bracket.

<form method="post" action="contact.php" onsubmit="window.open('contact.php','popup','width=200,height=200,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false">
        Name: <input name="name" type="text" maxlength="15" value="">
        <br />
Email:&nbsp;&nbsp;<input name="email" type="text" maxlength="50"  value="">
<br />
Suggestion:<br />
<textarea name="message" rows="5" cols="40"  value=""></textarea>
<br>
<input type="submit" value="Submit"><input type="reset" value="Reset">
	    </form>
$to = "email ommitted";
$subject = "Contact Us";
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$embody = "Name: $name\nEmail: $email\nSuggestion: $message" ;
$sent = mail($to, $subject, $embody, $headers) ;
if(empty($name)||empty($mail)||empty($message))  {
	echo "You seem to have left something out. Please fill in all the fields and try again.<br /><br /><a href=\"javascript:closeWindow();\">Close</a>"; }
else 
if($sent)
	{echo "Thank you $name, your mail has been sent successfully with the message of:<br /><br /><i>$message</i><br /><br /><a href=\"javascript:closeWindow();\">Close</a>"; }
else
	{echo "We encountered an error sending your mail<br /><br /><a href=\"javascript:closeWindow();\">Close</a>"; }
?>

Still same problem :/ get blank error even when all boxes are filled, forgot to add the HTML form before. Possible conflict with value=""?

Yes you should not use value="" in your source, and more over the default will be null, it is not necessary to put that, remove that and retry again

Change empty($mail) to empty($email) There's a discrepancy between your variables. $mail does not exist.
Also, you should really do your validation before sending the e-mail with mail(). This would avoid a lot of unnecessary blank e-mails being sent.

Also, do what saiprem said and remove the value = "" attributes from your HTML form. value isn't even a valid attribute of <textarea> .

Thanks for the discrepancy note

How would I go about doing validation beforehand?

Well, you have your mail() function before the if(empty) functions. What you should really do is:

if(empty($email)...etc...) {
    echo "error";
}
else {
    mail($to,$etc);
    echo "success";
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.