soullessj Posted June 9, 2011 Share Posted June 9, 2011 What i need to do is in the hyperlink add a variable to be carried over ie. id = 2. if im not mistaken i can just add a name tag and put id = 2 for it. and then use that as the id variable in the next page. then i need to tell the next page to use that variable so that i can use it in a sql query command to display data from the table where the id is 2 and show the relative information. just need the hyperlink and how to include what that id variable will be so that i can query for just that information. Thanks Link to comment https://forums.phpfreaks.com/topic/238865-hyperlinks-and-carrying-a-variable-over/ Share on other sites More sharing options...
gristoi Posted June 9, 2011 Share Posted June 9, 2011 What you are doing is attempting to pass a GET parameter through the url. This is done using the following syntax: <?php $id = '1224'; <a href="http://www.somesite.com/somepage.php?id=$id"></a> // you can append as many variables as you need. These have to be seperated by the & sign. <a href="http://www.somesite.com/somepage.php?id=$id&id2=$id2.........."></a> then on the page you are sending the variables to: $id = $_GET['id]; Link to comment https://forums.phpfreaks.com/topic/238865-hyperlinks-and-carrying-a-variable-over/#findComment-1227362 Share on other sites More sharing options...
soullessj Posted June 9, 2011 Author Share Posted June 9, 2011 cool thanks i will try it out Link to comment https://forums.phpfreaks.com/topic/238865-hyperlinks-and-carrying-a-variable-over/#findComment-1227364 Share on other sites More sharing options...
soullessj Posted June 10, 2011 Author Share Posted June 10, 2011 Yo thanks it worked out i managed to carry the id variable over and use it in a mysql query so that i could show the data i wanted. Thanks Link to comment https://forums.phpfreaks.com/topic/238865-hyperlinks-and-carrying-a-variable-over/#findComment-1227817 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.