Gotharious Posted November 4, 2011 Share Posted November 4, 2011 Hello there, I'm trying to make when you click on a record, it opens another page with full details about this record the code for it is <td><a href=\"user.php?id=".$row['id']."\">".$row['id']."</a></td> and it's working right, but when it opens the other page, no records is shown about the user with that ID So I figure the problem that I need to pass $row['id'] to my second page and make it search for it in the database how can I do that? here is the code from the second page (details of the record) $dbObj = new DB(); $result = mysql_query("select * from users where id = '$userID'"); return $result; $row = @mysql_fetch_array($result); echo "<table width=98%>"; echo "<tr>"; echo "<td valign=\"top\" width=\"120px\">"; $rowid = $row['id']; echo "<td valign=\"top\">"; echo "<table> <tr> <td valign=\"top\" class=\"searchtitle\"> ".$row['fname']. ' ' .$row['mname']. ' ' .$row['lname']." </td> </tr> <tr> <td class=\"text\" valign=\"top\"> ".$row['mobile']." </td> </tr> <tr> <td> <a href=\"user.php?id=".$row['recruiterid']."\" class=\"link\">".$row['recruiterid']."</a> </td> </tr> </table>"; echo "</td>"; echo "</tr>"; echo "</table>"; Quote Link to comment https://forums.phpfreaks.com/topic/250466-click-on-record-to-open-another-page-with-full-details/ Share on other sites More sharing options...
trq Posted November 4, 2011 Share Posted November 4, 2011 Firstly, where is $userID defined? Secondly, what is that return statement doing there? Quote Link to comment https://forums.phpfreaks.com/topic/250466-click-on-record-to-open-another-page-with-full-details/#findComment-1285096 Share on other sites More sharing options...
Gotharious Posted November 4, 2011 Author Share Posted November 4, 2011 It's not defined, that's what I'm saying, I want to define it to the user ID in the first line of code i posted so I can use it in the second page to display details of a user, I just don't know how to define it between those two pages I was following a blog post, and they used that return, but no luck following their instructions anyway Quote Link to comment https://forums.phpfreaks.com/topic/250466-click-on-record-to-open-another-page-with-full-details/#findComment-1285101 Share on other sites More sharing options...
seany123 Posted November 4, 2011 Share Posted November 4, 2011 your form is telling the next page that id=1 so you need to use $_GET['id'] on the second page's query. Quote Link to comment https://forums.phpfreaks.com/topic/250466-click-on-record-to-open-another-page-with-full-details/#findComment-1285102 Share on other sites More sharing options...
trq Posted November 4, 2011 Share Posted November 4, 2011 This post should give you a near complete working example of what your trying to do. Quote Link to comment https://forums.phpfreaks.com/topic/250466-click-on-record-to-open-another-page-with-full-details/#findComment-1285103 Share on other sites More sharing options...
Gotharious Posted November 4, 2011 Author Share Posted November 4, 2011 Worked, Thanks a lot guys Quote Link to comment https://forums.phpfreaks.com/topic/250466-click-on-record-to-open-another-page-with-full-details/#findComment-1285105 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.