I can’t quite get this figured out and maybe I am going about it the wrong way?? (more than likely!) I have searched and tried dozens of example to no avail Here is what I would like to do: I have a php webpage with 2 radio buttons for the user to select if they live in the US or other country. There are 2 text boxes for input but the label for them have to change based on the selection. If they select US the labels will be city and state, if they select Other, then the labels will be Latitude and Longitude. I think I might have to use JS or Ajax to accomplish this? My thought was to capture an onclick or onchange event and then capture the variable value and store it, then reload the page? (I have the logic to load the page correctly based on the variable value. Here is the code for the buttons and textboxes.
Select your country
<input type="radio" id="us" name="country" value="US" onclick="displayRadioValue()" <? if ($COUNTRY=="US") echo "checked"; ?>>
<label for="us">US</label>
<input type="radio" id="other" name="country" value="Other" onclick="displayRadioValue()"<? if ($COUNTRY=="Other") echo "checked"; ?>>
<label for="other">Other</label><p/>
<? if ($COUNTRY=="US"){
echo "City:";
} else {
echo "Latitude";
}
?>
<input type="text" name="CITY" size="16" value="<? echo $CITY; ?>"> <p>
<? if ($COUNTRY=="US"){
echo "State:";
} else {
echo "Longitude";
}
?>
<input type="text" name="STATE" size="12" value="<? echo $STATE; ?>"> <p>
What would be the best way to do this?