CSS Div send vars to PHP function

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
sleepydad
Forum Commoner
Posts: 75
Joined: Thu Feb 21, 2008 2:16 pm

CSS Div send vars to PHP function

Post by sleepydad »

I am using a CSS popup which calls in a PHP page using include(). The contents of the page being called in are dynamically generated based on a variable which I've named '$id'.

Code: Select all

<?PHP
function callPage($id) {
include("page.html?id=".$id);
}

echo "<a onmouseover='this.style.cursor=\"pointer\" ' onfocus='this.blur();' onclick=\" document.getElementById('PopUp').style.display = 'block'\" ><span style=\"text-decoration: none;\">".$row['title']."</span></a><br>";

$id=xx;
callPage($id)

///// MORE CSS
?>
Somehow I need the onclick handler to get the value of $id from my CSS statement to the the variable $id to be used in the function callPage(). Variable $id will come from a database using $row['id'].

Three days working on this on my own and no solution. I'm beginning to think this may be impossible. Anyone have any suggestions?

Thanks!
katierosy
Forum Commoner
Posts: 27
Joined: Wed Apr 07, 2010 8:39 am

Re: CSS Div send vars to PHP function

Post by katierosy »

Add the ID to the HTML element, which need to clicked to get the popup. Use jQuery (http://api.jquery.com/event.target/) to get the clicked ID from the HTML element and store it in a variable. then pass the value to PHP function and get the desired output.
Post Reply