How can I pass a variable ($member_id) to the target php page(Member Profile details Query)?
///-----
echo '<div id="show_profile_box">Show Member Profile details
//MySQL Query to display member profile details</div>
<div id="display_member_id"><a href="show_profile.php"?member_id=$member_id">Display Member id</a></div>';
echo '<script>
$("#show_profile_box").hide(100);
$("#display_member_id").click(function () {
$("#show_profile_box").show(500);
});
</script>';
Thank you. Let me know if you need more info.
* The whole idea is to display/show SELECTED member profile details. *
You are using single quotes. Single quotes do not parse PHP variables. When outputting multiline HTML from PHP, use heredoc :
Also, note that the variable do not have to be enclosed by
{}but still a good practice to do so.This will create a link like “
show_profile.php?member_id=3” that, if you click on the link, will call the script with the$_GET['member_id'] = 3. You can even get the page content via a XHR call inside yourclickevent :