+ 1

Cant get the right radiobox checked

Hello Folks.. I'm trying to get the value from database and according to that value make the radio button checked. Here is my trial code but it doesnt work... function anasayfa_sablon (){ $anasayfasablonu = get_option('anasayfa_sablon'); if ($anasayfasablonu === 'sablon1') { $sablon1 = 'true'; $sablon2 = 'false'; $sablon3 = 'false'; }elseif ($anasayfasablonu === 'sablon2') { $sablon1 = 'false'; $sablon2 = 'true'; $sablon3 = 'false'; }else { $sablon1 = 'false'; $sablon2 = 'false'; $sablon3 = 'true'; } echo "$sablon1, $sablon2, $sablon3"; echo '<p>Birinci ƞablon</p><input type="radio" checked="'.$sablon1.'" id="sablonsecimi1" name="anasayfa_sablon" value="sablon1"> <p>Ä°kinci ƞablon</p><input type="radio" checked="'.$sablon2.'" id="sablonsecimi2" name="anasayfa_sablon" value="sablon2"> <p>ĂœĂ§ĂŒncĂŒ ƞablon</p><input type="radio" checked="'.$sablon3.'" id="sablonsecimi3" name="anasayfa_sablon" value="sablon3"> <p>'.$anasayfasablonu.'</p>'; }

31st Dec 2017, 4:52 PM
Ä°smail GĂŒlseren
Ä°smail GĂŒlseren - avatar
1 Answer
+ 6
do a favor and check the html separate from your php to ensure that UI is ok and you have problem with backend. then search the internet for Similar projects to find out. hope it helps sincerly, Amir
4th Jan 2018, 9:38 AM
Alfred