Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP, MySql, Form question...

Status
Not open for further replies.

GiffordS

Programmer
May 31, 2001
194
CA
Ok, this is going to sound a little goofy. I have info in a MySql database, which I am retreiving via PHP, then echoing the results to a table. No problem there at all. The issue is that I then want each individual row of the table to be a link to another page which has access to the results variables in that row. The only way I can see to do this is through a form with hidden variables. The problem is that I want either the row itself, or the text within the cells to be the clickable link that opens the other page. I don't want a submit button, and so far as I can tell this only leaves me with either registering all of my results as session variables...(bad idea),... or literally generating each row as an on the fly image in PHP, which I'm afraid would require a great deal of time. Any other suggestions?
 
Give each row in MySQL a unique id and then retrieve the id and build the link using the id.

// get a list and make links to each item

$result = mysql_query("SELECT * FROM your_table",$db);

while ($myrow = mysql_fetch_array($result)) {

printf(&quot;<a href=\&quot;%s?id=%s\&quot;>%s</a> \n&quot;, $PHP_SELF, $myrow[&quot;id&quot;], $myrow[&quot;name&quot;]);
} I can't have sent that email, it says from Superuser.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top