Announcement

Collapse
No announcement yet.

Change data form columns to rows

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Kind Regards
    Rob
    www.gnjgf.co.za
    www.oryan-projects.com

  • #2
    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.
    Mattski

    http://www.ScorpioFire.com


    Comment

    Working...
    X