⊗ppPmFmRdSV 310 of 447 menu

Saving the Selected Value in Radio Buttons After Submission in PHP

Let's write code that will save the selected radio button after form submission:

<form action="" method="GET"> <input type="radio" name="radio" value="1" <?php if (!empty($_GET['radio']) and $_GET['radio'] === '1') { echo 'checked'; } ?>> <input type="radio" name="radio" value="2" <?php if (!empty($_GET['radio']) and $_GET['radio'] === '2') { echo 'checked'; } ?>> <input type="radio" name="radio" value="3" <?php if (!empty($_GET['radio']) and $_GET['radio'] === '3') { echo 'checked'; } ?>> <input type="submit"> </form>

Using radio buttons, ask the user to select their language. Make sure the selection does not disappear after form submission.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline