title: How to save website form data(php) to my server?
body: <p>I am setting up a website on my own home server using a website template. The contact form uses php and the php mail() function to email to info entered in the contact sheet, but I don't have a local smtp server to use in the mail(). So I want to alter the code to instead save the submitted info to a text file. If there is a possible way to do this can someone point me in the correct direction. my current html code and php code are as follows:
  HTML:</p>
  
  <pre><code>    &lt;form action="mailer.php" id="contact_form" method="post"&gt;
  
              &lt;ul class="form"&gt;               
  
                  &lt;li class="short"&gt;
                      &lt;label&gt;First Name&lt;span class="required"&gt;&lt;/span&gt;&lt;/label&gt;
                      &lt;input type="text" name="first" id="first" value="First Name" class="requiredField" onblur="if(this.value == '') { this.value = 'First Name'; }" onfocus="if(this.value == 'First Name') { this.value = ''; }" /&gt;
                  &lt;/li&gt;
  
                  &lt;li class="short"&gt;
                      &lt;label&gt;Last Name&lt;span class="required"&gt;&lt;/span&gt;&lt;/label&gt;
                      &lt;input type="text" name="last" id="last" value="Last Name" class="requiredField" onblur="if(this.value == '') { this.value = 'Last Name'; }" onfocus="if(this.value == 'Last Name') { this.value = ''; }" /&gt;
                  &lt;/li&gt;
  
                  &lt;li class="long"&gt;
                      &lt;label&gt;Email Address&lt;span class="required"&gt;&lt;/span&gt;&lt;/label&gt;                  
                      &lt;input type="text" name="email" id="email" value="Email Address" class="requiredField email" onblur="if(this.value == '') { this.value = 'Email Address'; }" onfocus="if(this.value == 'Email Address') { this.value = ''; }" /&gt;                        &lt;/li&gt;
  
                  &lt;li class="short"&gt;
                      &lt;label&gt;Company Name&lt;/label&gt;
                      &lt;input type="text" name="company" id="company" value="Company Name" class="requiredField" onblur="if(this.value == '') { this.value = 'Company Name'; }" onfocus="if(this.value == 'Company Name') { this.value = ''; }" /&gt;
                  &lt;/li&gt;
  
                  &lt;li class="short"&gt;
                      &lt;label&gt;Telephone Number&lt;/label&gt;
                      &lt;input type="text" name="phone" id="phone" value="Telephone Number" class="requiredField" onblur="if(this.value == '') { this.value = 'Telephone Number'; }" onfocus="if(this.value == 'Telephone Number') { this.value = ''; }" /&gt;
                  &lt;/li&gt;
  
                  &lt;li class="textarea"&gt;
                      &lt;label&gt;Message&lt;span class="required"&gt;&lt;/span&gt;&lt;/label&gt;
                      &lt;textarea name="message" id="message" rows="20" cols="30"&gt;&lt;/textarea&gt;
                  &lt;/li&gt;
  
                  &lt;li class="button"&gt;&lt;input name="submitted" id="submitted" value="Submit" class="submit" type="submit" /&gt;
                  &lt;/li&gt;
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>    &lt;?php
      $email_to = "michaelggerhart@gmail.com";
      $first = $_POST["first"];
      $last = $_POST["last"];
      $email = $_POST["email"];
      $company = $_POST["company"];
      $phone = $_POST["phone"];
      $message = $_POST["message"];
      $text = "NAME: $first    $last &lt;br&gt;
       EMAIL: $email&lt;br&gt;
       COMPANY: $company&lt;br&gt;
       TELEPHONE NUMBER: $phone&lt;br&gt;    
       MESSAGE: $message";
      $headers = "MIME-Version: 1.0" . "\r\n"; 
      $headers .= "Content-type:text/html; charset=utf-8" . "\r\n"; 
      $headers .= "From: &lt;$email&gt;" . "\r\n";
      mail($email_to, "Message", $text, $headers);
      ?&gt;   
  </code></pre>