My assignment asks me to make a select list of colors and then use PHP to print a statement in the color selected. Here's exactly what it said:
Make an HTML form with a select-option list with the following color options: Red, Blue, and Green.
When the user makes a selection and clicks the submit button display the following line in whatever color they selected. If they choose red, for example, it would look like...
Color me happy
Use a CSS class to set the color of the text.
THIS IS WHAT HE SAID TO DO:
HTML
<p>
<select name="colorchoice" size="1">
<option value="redtext">Red</option>
<option value="bluetext">Blue</option>
<option value="greentext">Green</option>
</select>
</p>
<p>
<input type="submit" value="Submit Information">
</p>
PHP
<?php
$colorvalue = $_POST['colorchoice'];
print "<span class='".$colorvalue."'> Color me happy.</span>";
?>
Obviously, this doesn't work without some CSS, which he so helpfully didn't mention.
.redtext{color:red;} .bluetext{color:blue;} .greentext{color:green;}