Jagand Posted August 16, 2012 Share Posted August 16, 2012 I have a webpage that has hundreds of links. Clicking on any of these links should drive a customer to same destination page but the content that is loaded on destination page should differ based on the link that customer has clicked. For example, on main page, if user clicks A, destination page should redirect user to destination.php and then load data related to A by fetching it from MySQL. So, with B where data loaded is specific to B and so with C. In order to do this, in the destination page, PHP should know if user clicked on A, B, C ... How can I code the program to detect which link the customer clicked? In Javascript, I can do this using onClick but in PHP, I am sure there must be a solution though such a solution might involve couple of data exchanges between server and client. Please help. Quote Link to comment Share on other sites More sharing options...
xyph Posted August 16, 2012 Share Posted August 16, 2012 <a href="destination.php?link=a"> Within PHP $_GET['link'] will contain 'a' Quote Link to comment Share on other sites More sharing options...
Jagand Posted August 16, 2012 Author Share Posted August 16, 2012 Thank you xyph. That works Quote Link to comment Share on other sites More sharing options...
xyph Posted August 16, 2012 Share Posted August 16, 2012 Don't forget to sanitize user input before using it in your query! Those users can give you nasty data, even when you take measures to prevent it Quote Link to comment 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.