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 Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.