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.
HTML
<form method="POST" action="colors.php">
<p>Enter Your favorite colors
<br /><input type="text" name="color1" size="20">
<br /><input type="text" name="color2" size="20">
<br /><input type="text" name="color3" size="20">
</p>
<input type="submit" value="Submit">
</form>
PHP
<table>
<tr>
$color= $_POST['color'];
$fp = fopen($filename, 'a');
$colors .= "<td>".$color1."</td>";
$colors .= "<td>".$color2."</td>";
$colors.= "<td>". $color3 ."</td>";
</tr>
</table>