table.php
| From: | Erico Henrique Guimaraes | Date: | Mon, 11 Oct 2004 20:52:13 +0000 |
| Subject: | table.php | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-14857@lists.php.net to get a copy of this message | ||
Dear sirs,
Sorry for disturbing you but I could not find any example on how to do it.
It´s simple: I have two files: tableA.php and tableB.php . I use PEAR
HTML/Table.php to retrieve a table, queried from a database, just like the
one below.
ID EMPRESA CPF/CGC
12345 COMPANY B 234567890
12346 COMPANY A 34321567
12347 COMPANY C 234563789
The code is:
$ntable = new HTML_Table("border=1 cellpadding=1 cellspacing=1 width=400");
$ntable -> setAutoGrow(true);
$headerStyle = "bgcolor=#99CCCC";
$colHeaders = array("ID", "EMPRESA", "CPF/CGC");
$ntable->addRow($colHeaders, $headerStyle, "TH");
while ($row = $res->fetchrow(DB_FETCHMODE_ASSOC)) {
$ntable->addRow(array($row["cmpy_id"],'<A
HREF="pear-cmpy.php".>'.$row["cmpy_name"].'</A>',$row["cmpy_cgc_cpf"]));
}
As you could note, one of the columns, namely EMPRESA, is a hyperlink, whose
content is $row["cmpy_name"]. What I want to do is simply to click on the
hyperlink and pass over from tableA.php the id number - $row['cmpy_id'] - of
the hyperlinked company to another page, namely tableB.php in order to
retrieve other information from the selected company by the user.
I don´t know whether this the best approach but I assume there are other
ways to do so. Actually I could do some workaround to do so but I would
like to write code in compliance to PEAR and its packages. Is there any
package more suitable to it than table.php?
best regards,
Érico Henrique Guimarães
Tel.: 0xx213891-4842 / 9414-2463