douduoyan5943 2018-03-07 15:04
浏览 40

为什么不能调用div#popup1?

Why cannot call the div #popup1? I want to pass the $row['staffId'] to div and call the popup to show the information .

$result = mysql_query("SELECT * FROM Staff WHERE companyId='$companyIdResult'");

echo "<div>
<table >";

while($row = mysql_fetch_array($result)){
  echo "<tr>";
  echo "<td >" . $row['staffName'] . "</td>";
  echo "<td>" . $row['staffPhone'] . "</td>";
  echo "<td><a class ='editbutton' href=' #popup1?edit_id=".$row['staffId'] ."'>Edit</a></td>";
  echo "</tr>";
}


echo "</table>";
echo "</div>";

if($_GET['edit_id'] != ""){
   $staffId = $_GET['edit_id'];

$sql2 = mysql_query("SELECT *FROM Staff WHERE staffId='".$staffId."'");
echo '<div id="popup1" class="overlay" >';
echo '<div class="popup">';
echo '<input type="text" name="staffName" value= ".$row['staffName']." ><br>';
echo '<input type="text" name="staffPhone" value=".$row['staffPhone']."><br>';
echo '</div>';
echo '</div>';
}
  • 写回答

1条回答 默认 最新

  • dsfsdfsd34324 2018-03-07 15:15
    关注

    First of all you cannot append query parameters (?edit_id=...) to an anchor like #popup1, also you seem to misunderstand how PHP and the browser interact, you cannot open a popup and create it dynamically on the server side the way you seem to plan to. You could use AJAX to load the matching form for the staffId into your popup or generate a popup for every staffId beforehand (and create matching links with different anchors), but you try to open a popup1 with values generated on the server side and that doesn't work in this way.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题