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
    New Coder
    Join Date
    Apr 2006
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    adding radio buttons

    hi
    i want to add a column for radio buttons at the end of my table but im not sure how 2 do it.
    my table looks like:

    Code:
     echo '<table align = "center" border = "1" cellspacing = "0" cellpadding = "5">
                  <tr>
                  <td align="left"><b>Type</b></td>
                  <td align="left"><b>Sleeps</b></td>
                  <td align="left"><b>Board</b></td>
                  <td align="left"><b>Description</b></td>
                  <td align="left"><b>Pets Allowed</b></td>
                  </tr>
                  ';
                  
                  while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
                    echo '
                  <tr>
                  <td align="left">'. $row['type']. '</td>
                  <td align="left">'. $row['sleeps']. '</td>
                  <td align="left">'. $row['board']. '</td>
                  <td align="left">'. $row['description']. '</td>
                  <td align="left">'. $row['pets_allowed']. '</td>
                  </tr>
                  ';
                  }
                  echo '</table>';
    has anybody got any ideas how i could do it?
    thanks

  • #2
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,830
    Thanks
    21
    Thanked 157 Times in 148 Posts
    PHP Code:
    echo '<form name="form1" action="#" method="post">';

    echo 
    '<table align="center" border="1" cellspacing="0" cellpadding="5">
                  <tr>
                  <td align="left"><b>Type</b></td>
                  <td align="left"><b>Sleeps</b></td>
                  <td align="left"><b>Board</b></td>
                  <td align="left"><b>Description</b></td>
                  <td align="left"><b>Pets Allowed</b></td>
                  <td></td>
                  </tr>
                  '
    ;
                  
    $query "SELECT * FROM table";
    $result mysql_query($query);

    $x=0;

    while (
    $row mysql_fetch_assoc($result))
    {
        echo 
    '
        <tr>
        <td align="left">'
    $row['type']. '</td>
        <td align="left">'
    $row['sleeps']. '</td>
        <td align="left">'
    $row['board']. '</td>
        <td align="left">'
    $row['description']. '</td>
        <td align="left">'
    $row['pets_allowed']. '</td>
        <td><input type="radio" name="button'
    .$x.'" value="val1"> <b>Value #1</b> <input type="radio" name="button'.$x.'" value="val2"> <b>Value #2</b></td>
        </tr>
        '
    ;

        
    $x++;
    }

    echo 
    '</table>';

    echo 
    '<input type="submit" value="Submit"></form>'
    Last edited by chump2877; 04-29-2006 at 01:53 AM.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :-)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!
    ♪♪ …Need Web Hosting For My YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪


  •  

    Posting Permissions

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