gavenf Posted December 6, 2007 Share Posted December 6, 2007 Hi peoples, I need help desperatly. My problem is that I would like the following code to link through to a page that will display the full results for the person that is selected on from this page. I have made the hyperlink the "first name" in this code. I have tried a hundred different ways to get it to work but I dont know what I am doign wrong. At the moment all that happens is it takes me to a blank page. How do I make the full record appear in a table on a new page. The full record for each person contains the following colums in the mysql table: name lastname dob address suburb state postcode country phone fax email Any help would be greatly appreciated. This page is called srch.php3 <html> <style type="text/css"> <!-- a:link { color: #0000FF; text-decoration: none; } a:visited { text-decoration: none; color: #FF0000; } a:hover { text-decoration: none; color: #FF0000; } a:active { text-decoration: none; color: #FF0000; } --> </style> <body> <? if ($search) // perform search only if a string was entered. { mysql_connect('localhost','xxxxxx','xxxxxx') or die ("Problem connecting to DataBase"); $srch="%".$search."%"; $query = "select * from visitors WHERE Name LIKE '$srch' || Last LIKE '$srch' || email LIKE '$srch' || comment LIKE '$srch'"; $result = mysql_db_query("xxxxxx", $query); if ($result) { echo "Here are the results:<br><br>"; echo "<table width=90% align=center border=1><tr> <td align=center bgcolor=#00FFFF>Visit time and date</td> <td align=center bgcolor=#00FFFF>User Name</td> <td align=center bgcolor=#00FFFF>Last Name</td> <td align=center bgcolor=#00FFFF>Email</td> </tr>"; while ($r = mysql_fetch_array($result)) { // Begin while $ts = $r["TimeStamp"]; $name = $r["Name"]; $last = $r["Last"]; $email = $r["email"]; $comment = $r["comment"]; echo "<tr> <td>$ts</td> <td><a href= $name>$name</td> <td>$last</td> <td><a href= mailto:$email>$email</td></tr> <tr> <td colspan=4 bgcolor=\"#ffffa0\">$comment</td> </tr>"; } // end while echo "</table>"; } else { echo "problems...."; } } else { echo "Search string is empty. <br> Go back and type a string to search"; } include ('links.x'); ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/80390-echo-hyperlink-search-results/ Share on other sites More sharing options...
trq Posted December 6, 2007 Share Posted December 6, 2007 You have not defined the $search variable anywhere. If your post uses the post method, it will be $_POST['search']. Quote Link to comment https://forums.phpfreaks.com/topic/80390-echo-hyperlink-search-results/#findComment-407617 Share on other sites More sharing options...
blueman378 Posted December 6, 2007 Share Posted December 6, 2007 also mate, you might want to load your results into an array, that will make it easier as you dont need to call each result seperatly, cheers Quote Link to comment https://forums.phpfreaks.com/topic/80390-echo-hyperlink-search-results/#findComment-407651 Share on other sites More sharing options...
gavenf Posted December 6, 2007 Author Share Posted December 6, 2007 also mate, you might want to load your results into an array, that will make it easier as you dont need to call each result seperatly, cheers I hate to sound like a tool (but I will anyway) but I dont know how to do what you are saying. I have learnt all this on my own and it has taken me ages so far. Can you offer an example to what you are saying please? Also by doing this will it make the full results appear on a new page? Quote Link to comment https://forums.phpfreaks.com/topic/80390-echo-hyperlink-search-results/#findComment-407659 Share on other sites More sharing options...
gavenf Posted December 6, 2007 Author Share Posted December 6, 2007 You have not defined the $search variable anywhere. If your post uses the post method, it will be $_POST['search']. Sorry but I really dont know how to implement what you have said. Any examples you could show me? Quote Link to comment https://forums.phpfreaks.com/topic/80390-echo-hyperlink-search-results/#findComment-407660 Share on other sites More sharing options...
trq Posted December 6, 2007 Share Posted December 6, 2007 Replace all instances of $search with $_POST['search']. Quote Link to comment https://forums.phpfreaks.com/topic/80390-echo-hyperlink-search-results/#findComment-407912 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.