pantinosm Posted January 13, 2007 Share Posted January 13, 2007 I just have a table of links and want to run a query when any of the hyperlinks is pressed. How do i do that?[code]<a href="<?php echo $row_rsfindwebsitesearch['URL']; ?>"><span class="style20">[/code]This should be somewhere in there.?? Quote Link to comment https://forums.phpfreaks.com/topic/34007-how-to-run-a-script-when-a-hyperlink-is-pressed/ Share on other sites More sharing options...
GingerRobot Posted January 13, 2007 Share Posted January 13, 2007 Im not quite sure what you are asking here. Do you think you could give a bit more information?Is it that you have lots of information and want to have links for searching and sorting this data? What type of searches would this be? Quote Link to comment https://forums.phpfreaks.com/topic/34007-how-to-run-a-script-when-a-hyperlink-is-pressed/#findComment-159842 Share on other sites More sharing options...
pantinosm Posted January 13, 2007 Author Share Posted January 13, 2007 I have a search engine and after a search i get a table list of urls. I want mainly when i click on a link/ hyperlink, to trigger an sql update query.How is this done? Thank you in advance. Quote Link to comment https://forums.phpfreaks.com/topic/34007-how-to-run-a-script-when-a-hyperlink-is-pressed/#findComment-159894 Share on other sites More sharing options...
jamesl Posted January 13, 2007 Share Posted January 13, 2007 If you want it to be seamless (Won't go to another page), you need to use an iframe, and have the link trigger a query in it from another .php file. You can set the iframed PHP file to use parent.xxx to change the HTML data of the main page, and just keep the main page hidden. Quote Link to comment https://forums.phpfreaks.com/topic/34007-how-to-run-a-script-when-a-hyperlink-is-pressed/#findComment-159930 Share on other sites More sharing options...
taith Posted January 13, 2007 Share Posted January 13, 2007 or even better then iframe... use ajax :-) Quote Link to comment https://forums.phpfreaks.com/topic/34007-how-to-run-a-script-when-a-hyperlink-is-pressed/#findComment-159933 Share on other sites More sharing options...
jamesl Posted January 13, 2007 Share Posted January 13, 2007 Ajax? Whosawhatahuh? I figured an iframe is the only way, seeing as PHP is Pre-Hypertext Processing... You'd need some form of new session, right? Quote Link to comment https://forums.phpfreaks.com/topic/34007-how-to-run-a-script-when-a-hyperlink-is-pressed/#findComment-159937 Share on other sites More sharing options...
OmarHaydoor Posted January 13, 2007 Share Posted January 13, 2007 I want beautiful counter please... Quote Link to comment https://forums.phpfreaks.com/topic/34007-how-to-run-a-script-when-a-hyperlink-is-pressed/#findComment-159943 Share on other sites More sharing options...
pantinosm Posted January 13, 2007 Author Share Posted January 13, 2007 Yes but with the iframe will it be dericted the link after the script is executed? Can i have a code sample please? Or an easier way maybe??? :( Quote Link to comment https://forums.phpfreaks.com/topic/34007-how-to-run-a-script-when-a-hyperlink-is-pressed/#findComment-159955 Share on other sites More sharing options...
redbullmarky Posted January 13, 2007 Share Posted January 13, 2007 if you want to run a query (ie, perform a server side action) without reloading the page, then as taith suggested, it'd be a job for AJAX and would be invoked using javascript's onClick method.for more info on AJAX, including tutorials, etc, try here: http://www.ajaxfreaks.com/ Quote Link to comment https://forums.phpfreaks.com/topic/34007-how-to-run-a-script-when-a-hyperlink-is-pressed/#findComment-159956 Share on other sites More sharing options...
taith Posted January 13, 2007 Share Posted January 13, 2007 http://www.phpfreaks.com/forums/index.php/topic,115581.0.html Quote Link to comment https://forums.phpfreaks.com/topic/34007-how-to-run-a-script-when-a-hyperlink-is-pressed/#findComment-159979 Share on other sites More sharing options...
pantinosm Posted January 14, 2007 Author Share Posted January 14, 2007 The only thing i want to do is when i press the hyperlink and get redirected, just run a script query. Is there an easy way or i have to use ajax? Quote Link to comment https://forums.phpfreaks.com/topic/34007-how-to-run-a-script-when-a-hyperlink-is-pressed/#findComment-160405 Share on other sites More sharing options...
GingerRobot Posted January 14, 2007 Share Posted January 14, 2007 Well then you make the link direct to the page that contains the the query? Or is the point that you are redirecting to a page/site out of your control and are, perhaps, recording which pages/sites a user has viewed? In which case, i think yes, you would have to use ajax. Quote Link to comment https://forums.phpfreaks.com/topic/34007-how-to-run-a-script-when-a-hyperlink-is-pressed/#findComment-160407 Share on other sites More sharing options...
pantinosm Posted January 14, 2007 Author Share Posted January 14, 2007 Exactly, i am trying to develop a seach engine, and when i click to redirect to a page, it goes to the page like www.cnn.com. I just want to add a vote to a counter in my db. Quote Link to comment https://forums.phpfreaks.com/topic/34007-how-to-run-a-script-when-a-hyperlink-is-pressed/#findComment-160416 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.