Answer the question
In order to leave comments, you need to log in
How to make a field with type radio remain selected after page refresh?
I've been fighting for the second day without success. Only it is necessary without js / jq and similar things, naked php.
echo '<input type="radio" name="test" value="1">1<br>';
echo '<input type="radio" name="test" value="2">2<br>';
echo '<input type="radio" name="test" value="3">3<br>';
echo '<input type="submit" value="go"><br>';
Answer the question
In order to leave comments, you need to log in
echo '<input type="radio" name="test" value="1" '.($_GET["test"] == 1? "checked":"" ).'>1<br>';
echo '<input type="radio" name="test" value="2" '.($_GET["test"] == 2? "checked":"" ).'>2<br>';
echo '<input type="radio" name="test" value="3" '.($_GET["test"] == 3? "checked":"" ).'>3<br>';
echo '<input type="submit" value="go"><br>';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question