Forum Moderators: coopster

Message Too Old, No Replies

Form associations

         

outdoorxtreme1

12:24 am on Feb 3, 2006 (gmt 0)

10+ Year Member



I have a form where I can select from a list of items. I want to be able to select an item and have different color name associated with each item. I also want the color name to be entered to mtSql data base. I know how to post the data to Mysql but I don't know how to modify this code for the color associations. Example colors would be yellow for atving and red for backpacking. Can someone please help me? Thanks.

<form name=form1 method=post action=load_db.php>
<table align=center border=0 width=30>
<tr>
<td align=center>Type of Location:</td>
</tr>
<tr>
<td align=center><select name="new_type" type="text" id="new_type" size="1">
<option value="ATVing">ATVing</option>
<option value="Backpacking">Backpacking</option>
</td>
</tr>
<tr>
<td>
<input type=submit name=Submit value=Submit>
</td>
</tr>
</table>
</form>

niels

4:11 pm on Feb 3, 2006 (gmt 0)

10+ Year Member



You could do something like this:

on load_db.php:

$new_type = $_POST["new_type"];

if($new_type=='ATVing')
{
$color="yellow";
}
elseif($new_type=='backpacking')
{
$color="red";
}