title: $subject in php mail form returning only first word in string
body: <p>I am currently learning php for a web interface class, and one of our assignments is to generate a basic form to send an email with.  We then have to be able to send a sample of that form in an email through html. I want to do this showing the the input that was entered when the email was sent.  I've got most of it working, I just can't get the $subject variable to completely populate within the sample. It will only show one word, and skip all others after the first space character.  (The same is true of the $from variable, however this will typically be an email address and thus its not a major issue) </p>
  
  <p>For example, if I send an email with the subject,"This is a test", when I receive the email in my inbox I will see the full subject "This is a test" in my email's subject line.  But when I open the email itself and look at the generated form sample I will only see "This" as the filled in subject. </p>
  
  <p>I am using the input, type="text" tag to enter the subject and I imagine that is part of the reason.  I can solve the problem using a textarea tag, but that's not really conventional and seems to defeat the purpose of the exercise.  Any help is appreciated. Thanks!</p>
  
  <p>Here is my code:
  (The first block is just a function to generate the form.) </p>
  
  <pre><code>function createForm() //create form upon page load
  {
      echo '&lt;form method="post"&gt;' . '&lt;br /&gt;';
      echo '&lt;fieldset&gt;' . '&lt;br /&gt;';
      echo '&lt;legend&gt;&lt;p&gt;Heading&lt;/p&gt;&lt;/legend&gt;' . '&lt;br /&gt;';
      echo 'To: &lt;input name="to" type="text" /&gt;' . '&lt;br /&gt;';
      echo 'From: &lt;input name="from" type="text" /&gt;' . '&lt;br /&gt;';
      echo 'Subject: &lt;input name="subject" type="text"  /&gt;' . '&lt;br /&gt;';
      echo '&lt;/fieldset&gt;' . '&lt;br /&gt;';
      echo '&lt;fieldset&gt;' . '&lt;br /&gt;';
      echo '&lt;legend&gt;&lt;p&gt;Content&lt;/p&gt;&lt;/legend&gt;' . '&lt;br /&gt;';
      echo 'Message: &lt;textarea name="message" cols="30" rows="10"&gt;&lt;/textarea&gt;' . '&lt;br /&gt;';
      echo '&lt;input name="send" type="submit" /&gt;' . '&lt;br /&gt;';
      echo '&lt;/fieldset&gt;' . '&lt;br /&gt;';
      echo '&lt;/form&gt;';
  }
  </code></pre>
  
  <p>And the actual send email code:</p>
  
  <pre><code>if(isset($_REQUEST['to'])) //send email 
  {
      $to = $_REQUEST['to'];
      $subject = $_REQUEST['subject'];
      $from = $_REQUEST['from'];
  
      $headers = "MIME-Version: 1.0" . "\r\n";
      $headers .= 'Content-Type: text/html; charset=iso-8859-1' . "\r\n";
      $headers .= "From: $from" . "\r\n";
      $headers .= "Reply-To:  $from"  . "\r\n";
      $headers .= "Subject: $subject" . "\r\n";
      $headers .= "X-Mailer: PHP/".phpversion() . "\r\n";
  
      //html message
      $message = '
      &lt;html&gt;
      &lt;body&gt;
      &lt;form&gt;
      &lt;fieldset&gt;
      &lt;legend&gt;Headings&lt;/legend&gt;
      To: &lt;input type="text" name="to" value=' . $_REQUEST['to'] . ' /&gt;&lt;br /&gt;
      From: &lt;input type="text" name="from" value=' . $_REQUEST['from'] . ' /&gt;&lt;br /&gt;
      Subject: &lt;input type="text" name="subject" value=' . $_REQUEST['subject'] . ' /&gt;
      &lt;/fieldset&gt;
      &lt;fieldset&gt;
      &lt;legend&gt;Content&lt;/legend&gt;
      Message: &lt;textarea name="message" cols="30" rows="10"&gt;' . $_REQUEST['message'] . '&lt;/textarea&gt;&lt;br /&gt;
      &lt;input type="submit" name="send" /&gt;
      &lt;/fieldset&gt;
      &lt;/form&gt;
      &lt;/body&gt;
      &lt;/html&gt;';   
  
      mail($to,$subject,$message,$from,$headers);
  
      echo "Message sent, thank you. &lt;br /&gt;";
      echo '&lt;a href="email.php"&gt;Return&lt;/a&gt;';
  }
  else
  {
      createForm(); //create form if no $to set. 
  }
  </code></pre>