(1) Allows a user to enter a temperature and based on a selection from a radio button, converts the temperature to either celcius or fahrenheit.
(2) Writes the output to another php page.
My problem lies when selecting either the celcius or fahrenheit radio button. How do I get either, based on selection, to write to the output? Do I need to write if/else statment or can I use case/switch?
I don't see your form, but sounds like either case or if else will do the trick. Imagining you are sending a radio button called temp_format
<INPUT type="radio" name="temp_format" value="c"> Use Celcius
<INPUT type="radio" name="temp_format" value="f"> Use Farenheit
Then in your php page you would just
if ($temp_format == 'c') { // or use the "proper" $_POST["temp_format"]
// show the celcius version
} else {
// show the farenheit version
}
You're not asking us to do your homework are you?
Reputation Points: 15
Solved Threads: 0
Junior Poster in Training
Offline 50 posts
since Mar 2005