NickG21 Posted January 22, 2007 Share Posted January 22, 2007 hey everyone, i was just wondering if anyone knew a good syntax to create a set of radio buttons through php. i am using a ZervWizard class for my base and it creates drop-downs in this method:[code]<?php foreach ($wizard->FreqOfMail as $k => $v) { ?> <option value="<?= $k ?>"<?php if ($wizard->getValue('FreqOfMail') == $k) { ?><?php } ?>> <?= $v ?> </option> <?php } ?>[/code]i was wondering if from this syntax anyone could help me dervive a way to make a set of radio buttons or a checkbox/checkboxes. any help is appreciatedthank you in advance Link to comment https://forums.phpfreaks.com/topic/35221-radio-buttons-in-php/ Share on other sites More sharing options...
Jessica Posted January 22, 2007 Share Posted January 22, 2007 Radio buttons are similar. Using what you have I'd do:[code]<?php foreach ($wizard->FreqOfMail as $k => $v) { print '<input type="radio" value="'.$k.'"'; if ($wizard->getValue('FreqOfMail') == $k) { print ' selected '; } print '">'.$v;}[/code] Link to comment https://forums.phpfreaks.com/topic/35221-radio-buttons-in-php/#findComment-166320 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.