coder9 Posted July 17, 2008 Share Posted July 17, 2008 hello brothers let say i have two links Link1 and Link2 that is on the same page. How does PHP determine which link was clicked. any sample script? I know this is very simple i'm just only lost right now. thanks. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 17, 2008 Share Posted July 17, 2008 use a get variable to transfer additional data. Quote Link to comment Share on other sites More sharing options...
coder9 Posted July 17, 2008 Author Share Posted July 17, 2008 use a get variable to transfer additional data. thanks cooldude832 can you show me a very basic sample of the get please. Quote Link to comment Share on other sites More sharing options...
l0ve2hat3 Posted July 17, 2008 Share Posted July 17, 2008 <?php if( $_GET['link']=='1' ){ echo "You Selected Link 1!"; } if( $_GET['link']=='2' ){ echo "You Selected Link 2!"; } ?> <a href="page.php?link=1">Link 1</a> <a href="page.php?link=2">Link 2</a> assuming you name the php file page.php Quote Link to comment Share on other sites More sharing options...
coder9 Posted July 17, 2008 Author Share Posted July 17, 2008 <?php if( $_GET['link']=='1' ){ echo "You Selected Link 1!"; } if( $_GET['link']=='2' ){ echo "You Selected Link 2!"; } ?> <a href="page.php?link=1">Link 1</a> <a href="page.php?link=2">Link 2</a> assuming you name the php file page.php Thanks man you are very helpful. 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.