0

Hello everyone! Guys I really need your help. I'm still a noob and a student. So I made a table for electoral officials and also I made a link where user can see the information of the certain candidates in mouseover box. But I'm still trying to figure out how to display the information of the candidates in mouseover box using php. Any help would be greatly appreciated.

Here is my code anyway:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>TITLE</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<script src="sorttable.js"></script>
<script type="text/javascript" src="jquery.min.js"></script>
    <script type="text/javascript">
      $(function() {
        var moveLeft = 20;
        var moveDown = 10;

        $('a#trigger').hover(function(e) {
          $('div#pop-up').show();
          //.css('top', e.pageY + moveDown)
          //.css('left', e.pageX + moveLeft)
          //.appendTo('body');
        }, function() {
          $('div#pop-up').hide();
        });

        $('a#trigger').mousemove(function(e) {
          $("div#pop-up").css('top', e.pageY + moveDown).css('left', e.pageX + moveLeft);
        });

      });
    </script>

</head>
<body>


<div id="page">


<?php

include('voting_connect.php');
{
$result = mysql_query("SELECT * FROM candidates WHERE c_position='Secretary'") 
or die(mysql_error());  

echo "<center><table id='tables' class='sortable'>";
echo "<tr><th>Secretary:</th></tr>";

        while($row = mysql_fetch_array( $result )) {


echo "<tr>";
$row['c_ID'];
echo '<td>' . $row['c_fname'] . ' ' . $row['c_lname'] .'</td>';

echo '<td><a href="?ID=' . $row['c_ID'] .'" id="trigger">View Profile</a></td>';

echo"</tr>";
}
echo"</table></center>";
}

?>

<div id="pop-up">

<h3>Profile:</h3>
<font color="black" size="3">
<?php

include('voting_connect.php');
{
$result = mysql_query("SELECT * FROM candidates WHERE c_position='Secretary'") 
or die(mysql_error());  
$row = mysql_fetch_array( $result );
echo 'Name: ' . $row['c_fname']. ' ' .$row['c_lname']. '' ;
}

?>

</font>   
</div>
</div>
</div>
<!-- end content -->
<div style="clear: both;">&nbsp;</div>
</div>
<!-- end page -->
</body>
</html>
2
Contributors
2
Replies
8
Views
5 Years
Discussion Span
Last Post by aianne
0

Oh I'm so sorry sir about that. I thought I didn't get a reply from my previous thread so that's why I made another thread. I'm so sorry. Anyway sir, about your answer in my previous thread, I don't think I can do it with AJAX. I still don't have any idea about it, maybe next month I'll try to take programming class for AJAX. but for now my class is more on PHP, HTML, CSS, MySQL and Javascript. On the code above sir, I can now display the information of the candidates on mouseover box but not in selected candidate when you hover the link. When I hover the link on the first, second, or third link it displays the same information. So do you have any idea sir how to display the information of the selected candidate onmouseover box? Any alternatives? I am so grateful sir for your reply. and I'm so sorry for my english. :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.