radio button checked by default

Discussion in 'PHP/MySql' started by pamelaluck, Jan 12, 2010.

Thread Status:
Not open for further replies.
  1. pamelaluck New Member

    Member Since:
    Jan 12, 2010
    Message Count:
    3
    Likes Received:
    1
    Hi,
    I have a section where when joining the customer must select if they are male or female. As its a male orientated site, i want the male default button to be selected as default, but i dont know how to do this...

    can anyone tell me what i need to do with this code ?

    Code:

    <td class="infoBoxContents"><?php echo tep_draw_radio_field('gender', 'm') . '&nbsp;&nbsp;' . MALE . '&nbsp;&nbsp;' . tep_draw_radio_field('gender', 'f') . '&nbsp;&nbsp;' . FEMALE . '&nbsp;' . (tep_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>': ''); ?></td>

    to make the MALE radio button checked by default

    thanks heaps !
  2. Zoli New Member

    Member Since:
    Jan 23, 2007
    Message Count:
    563
    Likes Received:
    37
    Location:
    Hungary
    Hi,
    Since you use function to render the inputs you should look into the tep_draw_radio_field() php function to see if it has third aruments specifying the checked state.
    Thanks
    1 people like this.
  3. SeoKungFu Active Member

    Member Since:
    Jul 10, 2009
    Message Count:
    688
    Likes Received:
    84
    Occupation:
    SEO NinJah
    ...or if it doesn't have support for 3rd argument to hardcode it it there and leave it mega undocumented so that the next guy will need to justify what's being paid for :)
    1 people like this.
  4. crivion Member

    Member Since:
    Nov 10, 2009
    Message Count:
    38
    Likes Received:
    0
    this should do it
    <?php echo tep_draw_radio_field('gender', 'm', CHECKED); ?>
Thread Status:
Not open for further replies.

Share This Page