Form submission sending blank info after every page visit
<p>I'm trying to add a form to my wordpress page however the problem I have now is that the form is sending an email to me anytime a page is visiting on my web page. I think its because I've put the php in the header file, so everytime header is loaded it sends an email. How do I make it only send the form submission email when its actually filled out?</p>

<p>HTML</p>

<pre><code> &lt;form name="infoform" method="post" action="" &gt;

  &lt;br&gt;&lt;input type="text" name="ffirstname" placeholder="First Name"/&gt;&lt;input type="text" name="lastname" placeholder="Last Name"/&gt;
  &lt;br&gt;&lt;br&gt;&lt;input type="text" name="address" placeholder="Address"/&gt;&lt;input type="text" name="unit" placeholder="Unit"/&gt;&lt;/br&gt;
  &lt;br&gt;&lt;input type="text" name="city" placeholder="City"/&gt;&lt;select name="province" &gt;
&lt;option value="ab"&gt;AB&lt;/option&gt;
  &lt;option value="BC"&gt;BC&lt;/option&gt; 
  &lt;option value="BC"&gt;MB&lt;/option&gt;
  &lt;option value="NB"&gt;NB&lt;/option&gt;
&lt;option value="NL"&gt;NL&lt;/option&gt;
&lt;option value="NS"&gt;NS&lt;/option&gt;
&lt;option value="ON"&gt;ON&lt;/option&gt;
&lt;option value="PE"&gt;PE&lt;/option&gt;
&lt;option value="QC"&gt;QC&lt;/option&gt;
&lt;option value="SK"&gt;SK&lt;/option&gt;
&lt;/select&gt;&lt;input type="text" name="postal" placeholder="Postal Code"/&gt;&lt;/br&gt;
&lt;br&gt;&lt;input type="text" name="country" placeholder="Country"/&gt;&lt;/br&gt;
&lt;Br&gt;&lt;input type="text" name="email" placeholder="Email"/&gt;&lt;input type="number" name="phone" placeholder="Phone#"/&gt;&lt;/br&gt;
&lt;br&gt; &lt;br&gt;&lt;input class="submit" type="submit" value="Next" /&gt;
</code></pre>

<p></p>

<p>CSS</p>

<pre><code>  &lt;style&gt;

  input[type=text], input[type=number], select[name=province]{ font-family: arial; width:100%;  
  border: 1px solid #E5E5E5; padding: 10px 20px;}
input[name=ffirstname] {width:49%; margin-right:1%; }
input[name=lastname] {width:49%; margin-left:1%; }
input[name=address] {width:65.6667%; margin-right:1%; }
input[name=unit] {width:32.3337%; margin-left:1%; }
input[name=city] {width:49%; margin-right:1%; }
select[name=province] {width:24%; margin-left:1%;}
input[name=postal] {width:24%; margin-left:1%; }
input[name=email] {width:49%; margin-right:1%; }
input[name=phone] {width:49%; margin-left:1%;}

input[class=submit] {

  background-color: #f05a28;
  color: white;
  padding: 8px 20px;
  margin-left: 85%;
  border-radius: 4px;
  border: none; !important;
  outline: none; !important ;
  cursor: pointer;
  box-shadow: none; !important;}
</code></pre>

<p></p>

<p>PHP</p>

<pre><code>&lt;?php

$name = $_POST['ffirstname'];
$lastname = $_POST['lastname'];
$address = $_POST['address'];
$unit = $_POST['unit'];
$city = $_POST['city'];
$province = $_POST['province'];
$postal = $_POST['postal'];
$country = $_POST['country'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$formcontent=" From: $name $lastname \n Address: $address 
\n Unit: $unit \n City: $city \n Province: $province \n 
Postal Code: $postal \n Country: $country \n 
Email: $email \n Phone: $phone \n ";
$recipient = "contact@justhired.ca";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");

?&gt;
</code></pre>