phpnoobie9 Posted February 28, 2008 Share Posted February 28, 2008 I have the names listed as a link through a loop. <?php while($whileloop = mysql_fetch_array($catresults)) { ?> <a href="#"><?php echo $whileloop['name'].'<br />'; ?></a> <?php } ?> When I click the link..how do I get it to display some information from the row? Link to comment https://forums.phpfreaks.com/topic/93508-how-do-i-display-information-from-a-row-through-a-link/ Share on other sites More sharing options...
haku Posted February 28, 2008 Share Posted February 28, 2008 First: get rid of the br tag. You don't need it, and its not doing anything for you. Second: what information do you want to display, where do you want to display it, and how do you want it displayed? Link to comment https://forums.phpfreaks.com/topic/93508-how-do-i-display-information-from-a-row-through-a-link/#findComment-479092 Share on other sites More sharing options...
revraz Posted February 28, 2008 Share Posted February 28, 2008 You need to use a $_GET statement. So your URL should be mypage.php?name=joe Then you use $_GET['name'] You would then query your DB on that name and retrieve/display whatever info you're looking for. Link to comment https://forums.phpfreaks.com/topic/93508-how-do-i-display-information-from-a-row-through-a-link/#findComment-479095 Share on other sites More sharing options...
deansatch Posted February 28, 2008 Share Posted February 28, 2008 Best off using id in case of two names the same: <ul> <?php while($whileloop = mysql_fetch_array($catresults)) { $name = $whileloop ["name"]; $id= $whileloop ["id"]; echo"</li><a href=\"details.php?id=$id\">$name</li></a>"; } ?> </ul> Link to comment https://forums.phpfreaks.com/topic/93508-how-do-i-display-information-from-a-row-through-a-link/#findComment-479102 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.