...

View Full Version : How to create an active link in a PHP search result?



CGDesigns
03-30-2010, 08:19 PM
Hi all,

I am trying to make a link from a PHP search result. To see what I'm trying to do, you can go to this page that I'm working on. You can search by "730000450." I want to link the account number on the results to another results page that has more detailed information about that specific account. I want to link it to this page that'll have specified results on it.

How do I create a link in PHP search results?

Thank you!

masterofollies
03-30-2010, 08:50 PM
You can use a while loop to do this. Basically it'd look like this


echo "<a href=\"accounts.php?id=$accountid\">$accountid</a>";

MattF
03-30-2010, 08:52 PM
The same as you'd link anything else. In your search page, for each result returned, insert a hyperling pointing to the page with an id which it van use to pull the respective record. Something along the lines of:



<a href="http://www.wagonerassessor.com/formresults.html?id=sql_query_id_here">View full results</a>


Then, on the formresults page, extract the id:



$id = intval($_GET['id']);


and run the db query for that id, (after validating and sanitising the id fully, of course).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum