+ 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 Odpowiedź
+ 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