灯箱不显示 php


Lightbox not showing php

我正在使用php为一个系统工作。我们有一个管理员.php页面,其中列出了所有申请人列表。我们希望当我们单击特定申请人的姓名时,会出现一个灯箱,显示有关申请人的更多信息。但是,下面的这些代码似乎不起作用,我不知道为什么。顺便说一句,我是php的新手。

 <?php
include('config.php');
$result = mysql_query("SELECT * FROM employee as t1")

or die(mysql_error());
echo "<table border='0' cellpadding='15' text-align = 'center' >";
echo "<tr>";
echo " <caption><b><font size = '5'> <h2>List of Applicants </h2> </b> </font><hr></caption>";
echo "<th>Applicant ID</th>";
echo "<th>Application Date</th>";
echo "<th>Name</th>";
echo "<th>Job</th>";
echo "</tr>";
while($row = mysql_fetch_array( $result ))
{
echo "<tr class='gradeC'>";
echo '<td><b><font color="#663300">' . $row['employee_id'] . '</font></b></td>';
echo '<td><b><font color="#663300">' . $row['date'] . '</font></b></td>';
echo '<td><b><font color="#663300"><a href="admin.php?hello=true">' . $row['fname'] . '</a></font></b></td>';
echo '<td><td>';
echo "</tr>";
}
echo "</table>";
function runMyFunction() {
echo "<div onclick ='"document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block''"></div>";
echo "<div id='"light'" class='"white_content'">This is the lightbox content. <a href = '"javascript:void(0)'" onclick = '"document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none''">Close</a></div>";
echo "<div id='"fade'" class='"black_overlay'"></div>";
    }
  if (isset($_GET['hello'])) {
      runMyFunction();
  }
 ?>

不确定,但我认为问题出在功能上,或者我使用灯箱代码出现的方式。

你能重写这一行吗

function runMyFunction() {
echo "<div onclick ='"document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block''"></div>";
echo "<div id='"light'" class='"white_content'">This is the lightbox content. <a href = '"javascript:void(0)'" onclick = '"document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none''">Close</a></div>";
echo "<div id='"fade'" class='"black_overlay'"></div>";
    }

function runMyFunction() {
?>
<div onclick ="document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'"></div>
<div id="light" class="white_content">This is the lightbox content. 
<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">Close</a></div>
<div id="fade" class="black_overlay"></div>
<?php }

通过消除斜杠可以帮助使代码更易于处理。

我希望这有所帮助。