Hello all
im am after a script that allows for a drop down menu that allows the user to select a item and store that item into the database currenty i have
//all database stuff here
$player_chr_pet = $_POST['chr_pet'];
$chr_health = '10'; // var set at 10 incase error and user cannot select what pet
// if form is submited insert data to database code here
$html_form = "
<select name=\"chr_pet\">
<option value=\"Pig\">Pig</option>
<option value=\"Dragon\">Dragon</option>
<option value=\"Cow\">Cow</option>
<option value=\"Horse\">Horse</option>
<option value=\"Bear\">Bear</option>
<option value=\"Cat\">Cat</option>
<option value=\"Zebra\">Zebra</option>
<option value=\"Tigar\">Tigar</option>
<option value=\"Chicken\">Chicken</option>
<option value=\"Elephant\">Elephant</option>
</select>
";
Now i need to know how to set variables according to what the user selected as there option
// if option chicken was selected set the variable health to 20
if ($_POST['chr_pet'] == chicken ) //unsure what goes here instead of chicken
{
$chr_health = '20';
}
if ($_POST['chr_pet'] == dragon)
{
$chr_health = '50';
}
// etc...