Results 1 to 2 of 2

Thread: Change data form columns to rows
      
   

  1. #1
    Rob (SA)'s Avatar
    Rob (SA) is offline Lieutenant Colonel
    Join Date
    Nov 2006
    Location
    Centurion, South Africa
    Posts
    580

    Default Change data form columns to rows

    Hi folks,

    I have a file that looks this this.



    I am lookin gfor some help to get the numbers listed in the red square at the bottom to appear in the row at the top and similarly to do the same excercise for the blue row and so on and so on.

    [PHP]<?
    echo "<td>$hole</td><td>${$lengthhole}</td><td>${$par_hole}</td><td>${$index_hole}</td>";
    echo "<td><input type=\"text\" maxlength=\"2\" size=\"2\" name=\"gross_score$hole\" value=\"${$gross_score}\"></td>";
    echo "<td><input type=\"text\" maxlength=\"12\" size=\"15\" name=\"gross_name\" value=\"$gross_name\" disabled></td>";
    echo "<td><input type=\"text\" maxlength=\"2\" size=\"2\" name=\"net_score\" value=\"$net_score\" disabled></td>";
    echo "<td><input type=\"text\" maxlength=\"12\" size=\"15\" name=\"net_name\" value=\"$net_name\" disabled></td>";
    echo "<td><input type=\"text\" maxlength=\"3\" size=\"3\" name=\"stableford\" value=\"$stableford\" disabled></td>";
    echo "<td><input type=\"checkbox\" name=\"fairway$hole\" value=\"1\" $fw_checkbox></td>";
    echo "<td><input type=\"checkbox\" name=\"gir$hole\" value=\"1\" $gir_checkbox disabled></td>";
    echo "<td><input type=\"text\" maxlength=\"2\" size=\"2\" name=\"putt$hole\" value=\"${$putt}\"></td>";
    echo "<td><input type=\"checkbox\" name=\"bunker$hole\" value=\"1\" $bunker_checkbox></td>";
    echo "<td><input type=\"checkbox\" name=\"sandsave$hole\" value=\"1\" $sandsave_checkbox disabled></td>";
    echo "<td><input type=\"text\" maxlength=\"3\" size=\"3\" name=\"drive$hole\" value=\"${$drive}\"></td>";


    echo "<td><select name='teeclub$hole'>";
    [/PHP]

    your help in this regard will b emost appreciated

  2. #2
    mattski's Avatar
    mattski is offline First Sergeant
    Join Date
    Jan 2008
    Location
    Colorado
    Posts
    80

    Default Re: Change data form columns to rows

    Rob,

    Tables can be a real pain to get right if you are hand coding them. I hand code most of my designs but use a WYSIWYG editor for complex table layouts and then wrap the PHP code around it.

    Without seeing your entire table layout it's hard to see where the issue is. Based on what you posted here I don't see that you have any rows defined. All you have here are <td> tags. Each row is surrounded by <tr> tags at the beginning of the row and </tr> tags at the end of the row. The <td> tags identify the column start and </td> tags identify the end of the column in the row.

    So what you want to do is have something that looks like this:

    HTML Code:
    <tr><td>Hole:</td><td>1</td><td>2</td><td>3</td></tr>
    <tr><td>Meters:</td><td>212</td><td>550</td><td>442</td></tr>
    Obviously you will be doing this in PHP and populating the data in the table but this is the general layout you'll want to follow.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49