I have multiple href tags each with a different ID. Now, I want to get the ID of the selected HREF tag I click. How can I do this in PHP?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is not possible to do that in PHP. You must use JavaScript and pass through GET parameters the ID of the clicked link.
If you have jQuery, It’d be like this:
So in your PHP code, you can use
$_GET['clicked_id']to identify which one was clicked.But the simpler way, is to generate unique URL’s for each
<a>tag. So, You can determine which URL was clicked without any JavaScript code, which, in this case, seems to be desnecessary.