I have several divs, which are made automatically by php script. Each div have and record from mysql database in it. And hidden input with value of unique ID. What I wan’t to do is when I click on each of this divs, I would like to open overlay with div in middle and use this id to acces another data in database. I have working overlay. I just don’t know how to pass that variable.
It’s something like this:
echo "<div class='friend'>".$a["username"]."<input type='hidden' value='$id'/>"."</div>";
I hope someone will understand what I’m asking for. 🙂 I know it’s terrible explanation.
Your clean code should be this:
But way more cleaner would be having a list of your friends like this:
When using jQuery for example you can handle click events with a few lines and pass your user id to an external PHP like this: