PHP mail blank variables
<p>I am trying to get my php validate that the user has put in the info that is needed.</p>

<p>I want to make sure that the person has put in there name and email.  When I put just:</p>

<pre><code>if(empty($name){
  blah blah
}
</code></pre>

<p>it gives the error but it still process the email. When I put:</p>

<pre><code>if(empty($name){
  blah blah
}else{
  blah blah
}
</code></pre>

<p>I get an error saying: <code>Parse error: syntax error, unexpected '}' in /home/dreamcpu/public_html/insert.php on line 34</code>.</p>

<p>Here is my php:</p>

<pre><code>&lt;?php
$con = mysql_connect("localhost","blah","blah");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$today = date("F j, Y, g:i a"); 
mysql_select_db("dreamcpu_contact_info", $con);
$sql="INSERT INTO contact_us (name, email,phone_number,job_request,DateRequested)
VALUES
('$_POST[name]','$_POST[email]','$_POST[phone_number]','$_POST[job_requested]','$today')";

if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error(). "Actual query: " . $sql);
}
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone_number'];
$job = $_POST['job_requested'];
if (empty($name)){
echo "The name field was blank. Please go back and fill in the required fields";
}
else
{
$to = "programmers@dreamcpu.com";
$subject = "A job have been requested";
$message = "On " . $today . " a job has been requested from " . $name . " please email them at " . $email . " or call them at " . $phone;
$headers = "From:" . $email;
mail($to, $subject, $message,$headers);
echo "&lt;h3 style='display:block;'&gt;Thank you for contacting DreamCPU. We have received   your request $_POST[name]. We will review it and contact you as soon as possible.&lt;/h3&gt;";
mysql_close($con)
}
?&gt;
</code></pre>
