hi
this code
<tr bgcolor="#FFFFFF">
<td colspan="3" height="40"><b><font color="#330066">Ethnicity (optional
- to be answered by U.S. citizens)</font></b><br>
<?
switch($ethnicity)
{
case "African American, not of Hispanic origin":
$ethnicityvalue="African American, not of Hispanic origin";
break;
case "Hispanic, not Puerto Rican or Mexican":
$ethnicityvalue="Hispanic, not Puerto Rican or Mexican";
break;
case "Native American/Alaskan Native":
$ethnicityvalue="Native American/Alaskan Native";
break;
case "Mexican American":
$ethnicityvalue="Mexican American";
break;
case "Asian American/Pacific Islander":
$ethnicityvalue="Asian American/Pacific Islander";
break;
case "Puerto Rican":
$ethnicityvalue="Puerto Rican";
break;
case "Caucasian/White, not of Hispanic Origin":
$ethnicityvalue="Caucasian/White, not of Hispanic Origin";
break;
}
?>
<div align="center">
<select name="ethnicity" size="1">
<option value=<? echo $ethnicity; ?> SELECTED>
<? echo $ethnicityvalue; ?>
</option>
<option value=""></option>
<option value="African American, not of Hispanic origin">African
American, not of Hispanic origin</option>
<option value="Hispanic, not Puerto Rican or Mexican">Hispanic,
not Puerto Rican or Mexican</option>
<option value="Native American/Alaskan Native">Native American/Alaskan
Native</option>
<option value="Mexican American">Mexican American</option>
<option value="Asian American/Pacific Islander">Asian American/Pacific
Islander</option>
<option value="Puerto Rican">Puerto Rican</option>
<option value="Caucasian/White, not of Hispanic Origin">Caucasian/White, not of Hispanic Origin</option>
</select>
</div>
</td>
pulls the value for $ethnicity from a mysql db. the data type for this field is varchar 50. it assigns another field $ethnicityvalue, the current value of $ethnicity. the user should be able to come to this page, see his previous answer to this question pre-selected in the drop down menu. the user should be able to change his answer, and resubmit the page, go to the page again and see his new answer preselected. there are other values on the same page he can change and resubmit in the same way.
this code is not working correctly. i can submit it for the first time or change the selection, then submit and it works fine - when i come back to the page, the previous answer is preselected in the drop down box.
but - when i leave this selection alone, and instead change answers to another field on the same page, then resubmit, my answer to this particular drop down box is lost. nothing is preselected. when i check the db, instead of
Caucasian/White, not of Hispanic Origin
being in the database, it reads just
Caucasian/White,
-i'm probably missing something really elementary. any suggestions on how to fix?
thanks
philosophia