Hope my title makes sense once I explain the issue. I have a page that reads MYSQL and creates a DIV for each user. This number of DIVs can be in the hundreds. In each DIV there's user info and such but a fancybox link depending on the DIV's need. So far I have had the DIVs with fancybox links created as such:


PHP Code:
    foreach ($aa as $value)
a bunch of other code that is pointless to this issue...
div class='msd_linksrow'><class=\"fancybox\" href=\"#message_".$userinfo->userid."\" >Message</a>&nbsp;</div>
       ...a bunch of other code that is pointless to this issue...

This creates a


            <div id="message_<?php echo $userinfo->userid; ?>" style="width:400px;display: none;">
                <p>Message <?php echo $userinfo->username; ?></p>
for each user and works perfectly. BUT the problem is that when I run the entire script which creates 3 other similar fancyboxes for each user it runs the loader.php far too much. If, for example I have 5 users, the foreach will loop 5 times which will create

            <div id="message_1"style="width:400px;display: none;">
                <p>Message user1<p>
            <div id="message_2"style="width:400px;display: none;">
                <p>Message user2<p>
            <div id="message_3"style="width:400px;display: none;">
                <p>Message user3<p>
            <div id="message_4"style="width:400px;display: none;">
                <p>Message user4<p>
            <div id="message_5"style="width:400px;display: none;">
                <p>Message user5<p>

Again, this works well but can slow my site down depending on how many users. The really big problem is trying to change '<p>Message user#<p>' to a fancybox for with its own javascripts. I have been replacing '<p>Message user#<p>' with '<?php require'form.form.php'; ?>


PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Contact Form Using CSS3 and FancyBox 2 from iAPDesign</title>


<?php echo $who?>
<div id="show_our_contact_form">
<h3>Send us Message / Feedback / Comment / Suggestions!</h3>
<p><span class="errormsg"></span></p>

<label for="name">* Name </label>
<input name="fname" type="text" id="name" minlength="4" maxlength="15" required/>

<label for="email">* Email </label>
<input name="email" type="text" id="email" required/>

<label for="message">* Message</label>

<textarea name="messages" id="message" minlength="2" required></textarea>

<input value="Send Message" type="button" id="send_form"/> 
<!-- Add our Jquery 1.8.2 -->
<script type="text/javascript" src="form/lib/jquery.validate.min.js"></script>
<!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> WILL USE IT LATER
<!-- Add Fancybobx JS File -->
<script type="text/javascript" src="form/lib/jquery.fancybox.js?v=2.1.3"></script>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=110994505629056";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<script type="text/javascript">


   closeBtn :true
  var name  = $("#name").val();
  var email  = $("#email").val();
  var message = $("#message").val();
   if( (name == "") || (email == "") || (message == "")){
    $(".errormsg").html(" * All fields Required").fadeIn("Slow").fadeOut(3000);
   }else if(!isValidEmailAddress(email)){
    $(".errormsg").html(" * Invalid Email").fadeIn("Slow").fadeOut(3000);
   } else{
     type :'POST',
     url  :'form/php/process.php',
     data :{ 'name'   : name,
        'email'  : email,
        'message': message,
     beforeSend: function(){
      $("#show_our_contact_form").empty().html("<h3>Sending your Message to our Awesome Boss! Please wait . . . </h3>");
      alert("Something went wrong!");
      $("#show_our_contact_form").empty().html("<h3>Your Message Successfully Delivered! <br/> Thank you</h3>");
 var isValidEmailAddress = function(email_add) {
  var pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i);
  return pattern.test(email_add);

Having form.php run for each user does work but extremely slows my site down.

I have tried to change the hyperlink to include the userinfo->userid like '<a class=\"fancybox\" href=\"userid=$userinfo->userid#message\" >Message</a>' which fails.

What I'm hoping for is a way to create a single DIV id'd as 'message' where I can send the variable '$userinfo->userid' so that the Message DIV runs the form once no matter the userid but will have the userid variable so I know who the form is from.