title: Populate the "recipient" in an email submit form from php file
body: <p>What I have is a template site I am selling to users that I am using php files to easily change the info per user but just making a few changes in an includes folder. What I am trying to accomplish with it now it being able to change the "recipient" of the email submit form from the include file as such:</p>
  
  <p>emailto.php = test@test.com</p>
  
  <pre><code>     &lt;form id="ContactForm" action="send.php" method="post"&gt;
          &lt;input type="hidden" name="emailto" value="?PHP require_once "includes/emailto.php"; ?"&gt;
            &lt;div&gt;
              &lt;div class="wrapper"&gt;
                &lt;div class="bg"&gt;
                  &lt;input class="input" type="text" name="name"&gt;
                &lt;/div&gt;
                Name: &lt;/div&gt;
              &lt;div class="wrapper"&gt;
                &lt;div class="bg"&gt;
                  &lt;input class="input" type="text" name="email"&gt;
                &lt;/div&gt;
                Email: &lt;/div&gt;
                 &lt;div class="wrapper"&gt;
                &lt;div class="bg"&gt;
                  &lt;input class="input" type="text" name="phone"&gt;
                &lt;/div&gt;
                Phone: &lt;/div&gt;
              &lt;div class="wrapper"&gt;
                &lt;div class="bg2"&gt;
                  &lt;textarea cols="1" rows="1" name="message"&gt;&lt;/textarea&gt;
                &lt;/div&gt;
                Message: &lt;/div&gt;
                 &lt;div class="wrapper"&gt;
                &lt;div class="bg"&gt;
                 &lt;input type="checkbox" checked="checked"&gt;
                &lt;/div&gt;
                I have read and understand the &lt;a href="terms-and-conditions.php"&gt;Terms &amp; Conditions.&lt;/a&gt; &lt;/div&gt;
              &lt;input type="submit" class="button" name="go" value="Submit" /&gt; &lt;/div&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>and here is the send.php file</p>
  
  <pre><code> &lt;?php 
   $emailto = $_POST['emailto'];
   $name = $_POST['name'];
   $email = $_POST['email'];
   $phone = $_POST['phone'];
   $message = $_POST['message'];
   $formcontent="From: $name \nEmail: $email \nPhone: $phone \nMessage: $message";
   $recipient = "$emailto";
   $subject = "Test Contact";
   $mailheader = "From: $email \r\n";
   mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
   header('Location: contact-us.php');
   ?&gt;
  </code></pre>
  
  <p>I can't get it to work quite right with the php file. Any suggestions would be greatly appreciated.</p>