title: PHP Send Script -- Checkbox verify
body: <p>URL: <a href="http://medtransportcenter.com/medical-transportation/los-altos/" rel="nofollow">http://medtransportcenter.com/medical-transportation/los-altos/</a>
  I have just recently updated my form to now include a checkbox. I'm trying to get the send-form.php script to recognize whether or not the checkbox was checked or not when it sends the confirmation email. I did some research and found that the following code will do the trick for checking whether it was checked. But, I inserted it and kept giving me syntax error when testing the form. I included the additional code I have for the php script and checkbox field below. Please help with this.  </p>
  
  <p>My whole form HTML:</p>
  
  <pre><code>&lt;div class="form-box"&gt;
  &lt;!-- Form --&gt;
  
  &lt;form id="proForm" action="send-form.php" method="post" &gt;
  
  &lt;h2 style="text-align:center;"&gt;REQUEST INFO&lt;/h2&gt;
          &lt;h3 style="text-align:center;"&gt;FREE EXPERT ADVICE&lt;/h3&gt;
  &lt;div class="form-content"&gt;
  &lt;!-- Form --&gt;
  
  &lt;table cellpadding="0" cellspacing="0" border="0"&gt;
  
  &lt;!--tr&gt;
  &lt;td class="field-full" colspan="2"&gt;
      &lt;div class="label"&gt;&lt;label for="www"&gt;&lt;b&gt;Your website URL&lt;/b&gt;&lt;/label&gt;&lt;/div&gt;
      &lt;input id="www" class="required defaultInvalidUrl url" maxlength="40" name="www" type="text" tabindex="2" value="http://" /&gt;
  &lt;/td&gt;
  &lt;/tr--&gt;
  &lt;tr&gt;
  &lt;th class="label" align="right"&gt;&lt;label for="nameis"&gt;Your name&lt;/label&gt;&lt;/td&gt;:&lt;td class="field"&gt;
    &lt;input id="nameis" class="required defaultInvalidEmail nameis" maxlength="40" name="nameis" type="text" tabindex="2" value="Required" 
          onfocus="if (this.value == 'Required') {this.value = '';}"
          onblur="if (this.value == '') {this.value = 'Required';}" size="40" /&gt;
  &lt;/td&gt;
  &lt;/tr&gt;                                   
  &lt;tr&gt;
  &lt;th class="label" align="right"&gt;&lt;label for="email"&gt;E-mail&lt;/label&gt;&lt;/td&gt;:&lt;td class="field"&gt;
    &lt;input id="email" class="required defaultInvalidEmail email" maxlength="40" name="email" type="text" tabindex="3" value="Required" 
          onfocus="if (this.value == 'Required') {this.value = '';}"
          onblur="if (this.value == '') {this.value = 'Required';}" size="40" /&gt;
  &lt;/td&gt;
  &lt;/tr&gt;   
  
  &lt;tr&gt;
  &lt;th class="label" align="right"&gt;&lt;label for="phone"&gt;Best Phone:&lt;/label&gt;&lt;/td&gt;
  &lt;td class="field"&gt;
    &lt;input id="phone" class="required defaultInvalidEmail phone" maxlength="40" name="phone" type="text" tabindex="4" value="Required" size="30" 
          onfocus="if (this.value == 'Required') {this.value = '';}"
          onblur="if (this.value == '') {this.value = 'Required';}" size="40" /&gt;
  &lt;/td&gt;
  &lt;/tr&gt;   
  
  &lt;tr&gt;
  &lt;th class="label" align="right"&gt;&lt;label for="bestime"&gt;
  Best time to reach you:&lt;/label&gt;&lt;/td&gt;
  &lt;td class="field"&gt;
    &lt;input maxlength="40" size="30" name="bestime" type="text" tabindex="5" value="" /&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
  &lt;th class="label" align="right"&gt;&lt;label for="phone"&gt;
  Origin:&lt;/label&gt;&lt;/td&gt;
  &lt;td class="field"&gt;
    &lt;input maxlength="40" size="30" name="origin" type="text" tabindex="5" value="" /&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
  &lt;th class="label" align="right"&gt;&lt;label for="phone"&gt;
  Destination:&lt;/label&gt;&lt;/td&gt;
  &lt;td class="field"&gt;
    &lt;input maxlength="40" size="30" name="destination" type="text" tabindex="5" value="" /&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  
  
  &lt;tr&gt;
  &lt;th class="label" align="right"&gt;&lt;label for="msg"&gt;
  Message:&lt;/label&gt;&lt;/td&gt;
  &lt;td class="field"&gt;
    &lt;textarea rows="3" cols="31" name="msg" tabindex="6"&gt;&lt;/textarea&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
  &lt;th class="label"&gt;&lt;label for="brochure"&gt;Request Brochures&lt;/label&gt;&lt;/td&gt;
  &lt;td class="field"&gt;
    &lt;input type="checkbox" name="brochure[]" value="Yes" /&gt;
  &lt;/td&gt;
  &lt;/tr&gt;       
  
  &lt;!--tr&gt;
  &lt;td class="field-full" colspan="2"&gt;
      &lt;div class="label"&gt;&lt;label for="msg"&gt;&lt;b&gt;Other&lt;/b&gt;&lt;/label&gt;&lt;/div&gt;
    &lt;textarea rows="3" cols="30" name="msg" tabindex="9"&gt;&lt;/textarea&gt;
  &lt;/td&gt;
  &lt;/tr--&gt;
  
  &lt;/table&gt;
  
  &lt;div class="terms"&gt;By clicking 'Send',&lt;br/&gt; you accept our &lt;a onclick="showTerms()"&gt;Privacy Policy&lt;/a&gt;. &lt;br /&gt;&lt;span style="font-size:14px;"&gt;Phone: 800-282-6878.&lt;/span&gt;&lt;/div&gt;
  
  &lt;div class="btn-box"&gt;&lt;input class="button1" type="submit" value="Send" tabindex="10" /&gt;&lt;/div&gt;
  
  
  &lt;!-- END Form --&gt;
  &lt;/form&gt; 
  &lt;/div&gt;
  </code></pre>
  
  <p>My PHP Script</p>
  
  <pre><code>&lt;?php
  
  //$www = '';    
  $email = '';
  $nameis = '';
  $phone = '';
  $bestime = '';
  //$address = '';
  $origin = '';
  $destination = '';
  $msg = '';
  $brochure = '';
  
  function getIp()
  {if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
      $ip_address=$_SERVER['HTTP_X_FORWARDED_FOR'];
  }
  
  if (!isset($ip_address)){
          if (isset($_SERVER['REMOTE_ADDR'])) 
          $ip_address=$_SERVER['REMOTE_ADDR'];
  }
  return $ip_address;
  }
  
  if(isset($_POST['brochure'])){
  $brochure_checked = $_POST['brochure'];} 
  else {
  $brochure_not_checked = $_POST['brochure'];
  }
  
  
  //taking info about date, IP and user agent
  
  $timestamp = date("Y-m-d H:i:s");
  $ip   = getIp();
  $host = gethostbyaddr($ip); 
  $user_agent = $_SERVER["HTTP_USER_AGENT"];
  
  
  //taking the data from form 
  
  //$www = addslashes(trim($_POST['www']));   
  $email = addslashes(trim($_POST['email']));
  $nameis = addslashes(trim($_POST['nameis']));
  $phone = addslashes(trim($_POST['phone']));
  $bestime = addslashes(trim($_POST['bestime']));
  //$address = addslashes(trim($_POST['address']));
  $origin = addslashes(trim($_POST['origin']));
  $destination = addslashes(trim($_POST['destination']));
  $msg = addslashes(trim($_POST['msg']));
  $brochure = addslashes(trim($_POST['brochure']));
  
  
  
  
  //preparing mail
  
  $headers = "MIME-Version: 1.0\n";
  $headers .= "Content-type: text/html; charset=utf-8\n";
  $headers .= "Content-Transfer-Encoding: quoted-printable\n";
  $headers .= "From: $email\n";
  
  $content = 'Name: '.$nameis.'&lt;br&gt;'.
  'E-mail: '.$email.'&lt;br&gt;'.
  'Phone: '.$phone.'&lt;br&gt;'.
  'Message: '.$msg.'&lt;br&gt;'.
  'Best Time to Call: '.$bestime.'&lt;br&gt;'.
  'Origin: '.$origin.'&lt;br&gt;'.
  'Destination: '.$destination.'&lt;br&gt;'.
  'Requested Brochure: '.$brochure.'&lt;br&gt;'.
  'Time: '.$timestamp.'&lt;br&gt;'.
  'IP: '.$host.'&lt;br&gt;'.
  'User agent: '.$user_agent;
  
  
  //sending mail
  
  mail("service@medtransportcenter.com","Los Altos, CA Landing Page Contact", $content, $headers);
  
  
  ?&gt;
  </code></pre>