Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    134
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Radio boxes to display data

    Hi Guys,

    i now know how to display the relevant data a user has selected using drop down boxes and arrays like:

    PHP Code:
                    <td align="right"><b>Format</b></td><td align="center"><select name="format">';
                    #########################################################################
                    foreach ($format_arrays as $value) {
                    echo "<option Value=\"{$value}\"";
                    if ($value == $format) { echo '
    SELECTED'; }
                    echo ">{$value}</option>";
                    }
                    #########################################################################               
            echo '  
    </select
    but im not sure how to do the same with radio buttons

    any help would be appreciated

    cheers

    Graham

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    Something like this:
    PHP Code:
    foreach ($format_arrays as $value)
    {
        echo 
    '<input type="radio" value="' $value '"' . ($value == $format ' checked="checked"' '') . '" />' $value;

    Not tested.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •