Hello

I have other pages which call the below function to retrieve data from a postgresql database and display them on a webpage. On this table, there are hyperlinks which allows you to sort that column when you click on it. The problem here is that I will need to create many similar files on my server. I hope to reduce the number, and I am wondering if any body can use PHP_SELF and suggest to me a more elegant way of doing it. Thanks in advance

function start_table()
{
echo '<TABLE CELLPADDING="2" CELLSPACING="0" BORDER=1>';

            for($col = 0; $col < $this->columns; $col++ )
            {


                    echo "<TH>";

                    if($col==0)
                    echo "<a href=webpurchase1.php>Products</a> ";

                    if($col==1)
                    echo "<a href=webpurchase2.php>Company Name</a> ";

                    if($col==2)
                    echo "<a href=webpurchase3.php>Contact Person</a> ";

                    if($col==3)
                    echo "<a href=webpurchase4.php>Address One</a>";

                    if($col==4)
                    echo "<a href=webpurchase5.php>Address Two</a> ";

                    if($col==5)
                    echo "<a href=webpurchase6.php>Email Address</a> ";

                    if($col==6)
                    echo "<a href=webpurchase7.php>Day Phone</a> ";

                    if($col==7)
                    echo "<a href=webpurchase8.php>Number of Servers</a> ";

                    if($col==8)
                    echo "<a href=webpurchase9.php>Number of Clients</a> ";

                    if($col==9)
                    echo "<a href=webpurchase10.php>Number of Branches</a> ";

                    if($col==10)

echo "<a href=webpurchase11.php>Business Area</a> ";

                    echo "</TH>\n";
            }
            echo "\n";
    }

    Have you looked at doing it with one file that you feed the vars to tell it what to do in a get style url?

    filename.php?topic=company_name&user=user_id

    and then just parse them out and use them in that one file?

      Write a Reply...