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. Link to comment https://forums.phpfreaks.com/topic/267184-creating-webpage-dynamically-in-php/ 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' Link to comment https://forums.phpfreaks.com/topic/267184-creating-webpage-dynamically-in-php/#findComment-1369928 Share on other sites More sharing options...
Jagand Posted August 16, 2012 Author Share Posted August 16, 2012 Thank you xyph. That works Link to comment https://forums.phpfreaks.com/topic/267184-creating-webpage-dynamically-in-php/#findComment-1370000 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 Link to comment https://forums.phpfreaks.com/topic/267184-creating-webpage-dynamically-in-php/#findComment-1370001 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.