clearwaters Posted December 31, 2011 Share Posted December 31, 2011 Hi, I have a search results from a query like this: Accomodation & Housing Aqua & Hatcheries Automotive Beauty,Body & Sourl Billing Construction Education Electrical & Electronics Entertainment Financial Services Food & Dining Freelancers Health Services Home & Garden Industries Miscellaneous I wanted to hyper link these lines as an input to further query: For example: A link should establish to line item Industries, when i click on this, a further query to run with the results from another table with key word "Industries". Can somebody please help me on this issue. I am using dream weaver 5.5 for this project, if any help in this issue is greatly appreciated. Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/254131-how-to-hyper-link-from-query-results/ Share on other sites More sharing options...
scootstah Posted December 31, 2011 Share Posted December 31, 2011 You would need AJAX to accomplish this. When you click the link you would send an AJAX request to a PHP script that ran the query and returned the results. Quote Link to comment https://forums.phpfreaks.com/topic/254131-how-to-hyper-link-from-query-results/#findComment-1302865 Share on other sites More sharing options...
clearwaters Posted December 31, 2011 Author Share Posted December 31, 2011 Thanks for the reply.. I am a new web programmer, per my understanding, AJAX is required to retrieve the results in same page, i need results to be appear in separate page. Can you please advice how to accomplish this. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/254131-how-to-hyper-link-from-query-results/#findComment-1302866 Share on other sites More sharing options...
jcbones Posted December 31, 2011 Share Posted December 31, 2011 It is hard to help you when you don't post code. You should be hyper-linking by setting the data to an anchor element, and passing a query string to the end of the URI. <?php echo '<a href="a/link/to/somewhere.php?find=' . $me . '">LINKING</a>'; //to get the value: if(isset($_GET['find'])) { echo $_GET['find']; } ?> $_GET Quote Link to comment https://forums.phpfreaks.com/topic/254131-how-to-hyper-link-from-query-results/#findComment-1302868 Share on other sites More sharing options...
clearwaters Posted December 31, 2011 Author Share Posted December 31, 2011 Below is the do while loop which is generating the results. <?php do { ?> <?php echo $row_category['category_name']."<br/>"; ?> <?php } while ($row_category = mysql_fetch_assoc($category)); ?></td> I wanted the loop results to be hyper linked and pass it to another query input value. Thanks much.... Quote Link to comment https://forums.phpfreaks.com/topic/254131-how-to-hyper-link-from-query-results/#findComment-1302870 Share on other sites More sharing options...
scootstah Posted December 31, 2011 Share Posted December 31, 2011 Thanks for the reply.. I am a new web programmer, per my understanding, AJAX is required to retrieve the results in same page, i need results to be appear in separate page. Can you please advice how to accomplish this. Thanks Not true at all. AJAX can access separate pages just fine. Quote Link to comment https://forums.phpfreaks.com/topic/254131-how-to-hyper-link-from-query-results/#findComment-1302880 Share on other sites More sharing options...
clearwaters Posted December 31, 2011 Author Share Posted December 31, 2011 Thank you Can you please refer above code (DO WHILE loop) which is generating the query results and advice me how to hyper link the results to another query. Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/254131-how-to-hyper-link-from-query-results/#findComment-1302881 Share on other sites More sharing options...
scootstah Posted December 31, 2011 Share Posted December 31, 2011 http://api.jquery.com/jQuery.post/ Quote Link to comment https://forums.phpfreaks.com/topic/254131-how-to-hyper-link-from-query-results/#findComment-1302883 Share on other sites More sharing options...
litebearer Posted December 31, 2011 Share Posted December 31, 2011 perhaps something like this... <?php do { ?> <a href="<NameOf2ndPage.php?NameOfUniqueValueToPass<?PHP echo $row_category['FieldNameOfUniqueValue']; ?>"><?PHP echo $row_category['category_name']; ?></a><br/" <?PHP } while ($row_category = mysql_fetch_assoc($category)); ?> Quote Link to comment https://forums.phpfreaks.com/topic/254131-how-to-hyper-link-from-query-results/#findComment-1302892 Share on other sites More sharing options...
litebearer Posted December 31, 2011 Share Posted December 31, 2011 Oops(missed the = sign)... <?php do { ?> <a href="<NameOf2ndPage.php?NameOfUniqueValueToPass=<?PHP echo $row_category['FieldNameOfUniqueValue']; ?>"><?PHP echo $row_category['category_name']; ?></a><br/" <?PHP } while ($row_category = mysql_fetch_assoc($category)); ?> Quote Link to comment https://forums.phpfreaks.com/topic/254131-how-to-hyper-link-from-query-results/#findComment-1302901 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.