******RESOLVED**************
Added numbers to the key's in the color array.
name='color[0]' ... etc
***RESOLVED*****************
Hello all. I have this code in which I want the checkbox's named color to become a PHP array. When the form posts itself and I call
$color I only get the last value selected from the check box.
Could anyone tell me why?
echo "
<form action='$PHP_SELF' method='post'>
<table width='90%' border='0' cellpadding='0' cellspacing='0'>";
echo "<tr><td align='center'><font class='text'>Please fill out all information below.</font></td></tr>
<tr><td align='center'><font class='text'>Message (not to exceed 5000 characters)</font></td></tr>";
echo "<tr><td align='center'><textarea name='message' cols='50' rows='10' class='input'></textarea></font></td></tr>";
echo "<tr><td align='center'><font class='text'>[<input type='checkbox' name='color[]' value='blue'>Blue] [<input type='checkbox' name='color[]' value='red'>Red]";
echo " [<input type='checkbox' name='color[]' value='purple'>Purple] [<input type='checkbox' name='color[]' value='orange'>Orange]</font></td></tr>
<tr><td align='center'><font class='text'>[<input type='checkbox' name='color[]' value='gray'>Gray] [<input type='checkbox' name='color[]' value='black'>Black]";
echo " [<input type='checkbox' name='color[]' value='green'>Green]</font></td></tr>
<tr><td align='center'><font class='text'>[<input type='radio' name='randomhow' value='letter' checked>Letter] [<input type='radio' name='randomhow' value='word'>Word]</font></td></tr>
<tr><td align='center'><font class='text'><input type='submit' name='submit' value=' Submit ' class='button' class='input'></font></td></tr>
</table>
</form>";
If for example I choose red, blue and purple and used this code
echo $color;
Then 'purple' would be the only word displayed.
Thanks!