title: How to retrieve multiple input names into one variable in PHP
body: <p>I have a program where the user can enter the names of there three favorite colors. When it is received by the PHP script I need them to be stored in one variable. If the user enters one color then one color is displayed and entered into the .txt file... if three colors are entered than all three colors are entered into the file etc. Is there a way to receive user input from three separate text fields into one variable? I want them to be displayed in 3 separate fields in an html table.</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;form method="POST" action="colors.php"&gt;
  
  &lt;p&gt;Enter Your favorite colors
      &lt;br /&gt;&lt;input type="text" name="color1" size="20"&gt;
      &lt;br /&gt;&lt;input type="text" name="color2" size="20"&gt;
      &lt;br /&gt;&lt;input type="text" name="color3" size="20"&gt;
      &lt;/p&gt;
  
  &lt;input type="submit" value="Submit"&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>&lt;table&gt;
  &lt;tr&gt;
   $color= $_POST['color'];
   $fp = fopen($filename, 'a');
    $colors .= "&lt;td&gt;".$color1."&lt;/td&gt;";
      $colors .= "&lt;td&gt;".$color2."&lt;/td&gt;";
      $colors.= "&lt;td&gt;". $color3 ."&lt;/td&gt;";
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>