如何在php中获取特定超链接的值,如果单击,则将该命名链接的会话发送到另一个页面


How to get the values of a specific hyperlink in php and if click, send to another page the session of that named link

view.php

$result = mysqli_query($conn, "SELECT * FROM insgroup WHERE insID = '".$_SESSION['insID']."' ") or die ("Error selecting group from sessions:".mysqli_error($conn));
echo "<table border='1' cellpadding='10'>";

echo "<tr><th>Group ID</th><th>Group Name</th><th>Group Description</th><th>Group Subject</th><th>Group Department</th><th>Group Owner</th><th>Group Section</th><th>Group Year Level</th></tr>";
while($row=mysqli_fetch_array($result))
{
  // set up a row for each record
  echo "<tr>";
  echo "<td>" . $row['groupid'] . "</td>";
  echo "<td><a class='group-name' name='group-home-redirect' href='grouphome.php'  >" . $row['groupname'] . "</a></td>";
  echo "<td>" . $row['groupdesc'] . "</td>";
  echo "<td>" . $row['groupsubject'] . "</td>";
  echo "<td>" . $row['groupdept'] . "</td>";
  echo "<td>" . $row['groupowner'] . "</td>";
  echo "<td>" . $row['groupsection'] . "</td>";
  echo "<td>" . $row['groupyearlevel'] . "</td>";
  echo "<td><a name='delete-grp-btn' href='editgroup.php?id=" . $row['groupid'] . "'>Edit Group</a></td>";
  echo "<td><a href='deletegroup.php?id=" . $row['groupid'] . "'>Delete Group</a></td>";
  echo "</tr>";
}
echo "</table><br><br><NOSCRIPT><FONT COLOR='#FF0000'><BR>Javascript is required to access this area. Yours seems to be disabled.</FONT></NOSCRIPT> ";
if($result === FALSE){
  echo "<script type='text/javascript'>alert('No rows for instructor' ".$_SESSION['insfname']." .".$_SESSION['inslname']." 'to be displayed.');</script>";      
}

该链接名为"组主页重定向"。当我创建一个组时,我希望显示在视图表中,如果用户单击组名,数据库中该组的值将自动使用会话调用。天哪,我真的不知道,

如果我明白你想要什么。。。

您可以在href中传递组ID。。。

类似于:

echo "<td><a class='group-name' name='group-home-redirect' href='grouphome.php?group=" . $row['groupid'] . "'  >" . $row['groupname'] . "</a></td>"

然后在grouphome.php上,您可以查找$_GET['group'],并使用它的值从表中获取您想要的所有内容。。。

就像你已经在上做的那样

echo "<td><a href='deletegroup.php?id=" . $row['groupid'] . "'>Delete Group</a></td>";

您是否计划像这样将代码和演示文稿保存在同一个文件中?