title: PHP Undefined variable for HTML Form
body: <p>I am trying to run a contact form PHP script and HTML form and when I run it I get the following errors.</p>
  <blockquote>
  <p>Notice: Undefined variable: name in /storage/ssd4/333/4197333/public_html/heros51/confirm.php on line 17</p>
  <p>Notice: Undefined variable: p in /storage/ssd4/333/4197333/public_html/heros51/confirm.php on line 18</p>
  <p>Notice: Undefined variable: message in /storage/ssd4/333/4197333/public_html/heros51/confirm.php on line 18</p>
  <p>Notice: Undefined variable: visitor_email in /storage/ssd4/333/4197333/public_html/heros51/confirm.php on line 21</p>
  </blockquote>
  <pre><code>&lt;form action=&quot;confirm.php&quot; method=&quot;POST&quot; &gt;
          &lt;label&gt;Name &gt;&gt;&lt;/label&gt;&lt;input id=&quot;name&quot; type=&quot;text&quot; /&gt;&lt;br /&gt;
          &lt;label&gt;Email &gt;&gt;&lt;/label&gt;&lt;input id=&quot;email&quot; type=&quot;text&quot; /&gt;&lt;br /&gt;
          &lt;label&gt;PRI &gt;&gt;&lt;/label&gt;&lt;input id=&quot;p&quot; type=&quot;text&quot; /&gt;&lt;br /&gt;
          &lt;label&gt;Message &gt;&gt;&lt;/label&gt;&lt;textarea id=&quot;message&quot; rows=&quot;1&quot;&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
          &lt;input type=&quot;submit&quot; value=&quot;submit&quot; /&gt;
          &lt;a class=&quot;button&quot; alt=&quot;&quot; href=&quot;index.html&quot;&gt;Cancel&lt;/a&gt;
      &lt;/form&gt;
  </code></pre>
  <p>The PHP which is linked looks like this:</p>
  <pre><code>if( isset($_POST['name']) &amp;&amp; isset($_POST['email']) &amp;&amp; isset($_POST['p']) &amp;&amp; isset($_POST['message']) ){
  $name = $_POST['name'];
  $visitor_email = $_POST['email'];
  $message = $_POST['message'];
  $p = $_POST['p'];
  $email_from = 'default03@securemail.com';
  $email_subject = &quot;New Form submission $name &quot;;
  $email_body = &quot;You have received a new message from the user $p.\n&quot;.  &quot;Here is the message:\n $message&quot;.
  $to = &quot;erixom@gmail.com&quot;;
  $headers = &quot;From: $email_from \r\n&quot;;
  $headers .= &quot;Reply-To: $visitor_email \r\n&quot;;
  }
  else
  echo &quot; ISSET FAIL&quot;;
  $email_from = 'default03@securemail.com';
  $email_subject = &quot;New Form submission $name &quot;;
  $email_body = &quot;You have received a new message from the user $p.\n&quot;.  &quot;Here is the message:\n $message&quot;.
  $to = &quot;test@gmail.com&quot;;
  $headers = &quot;From: $email_from \r\n&quot;;
  $headers .= &quot;Reply-To: $visitor_email \r\n&quot;;
  mail($to,$email_subject,$email_body,$headers);
  ?&gt;
  </code></pre>