我对 GET 函数有疑问。我目前有一个带有 get 操作的表单。我正在使用 get 函数在另一个页面中访问该数据。不幸的是,我的每一个值都收到“错误:未定义的索引”。在阅读了类似的问题后,我尝试使用 isset(如下所示)并且它消除了错误,但我不确定我的数据是否存储在变量中,因为如果我回显 4 个变量,则没有任何显示. 有人可以推动我朝着正确的方向前进吗?
表格中的数据:
while($row = mysql_fetch_array($result)) {
echo "<div class=\"addform\"><form method='GET' action=\"update.php\">\n";
echo " <input type=\"text\" value=\"".$row['tfid']."\" name=\"tfid\">\n";
echo " <input type=\"text\" name=\"fname\" value=\"".$row['fname']."\"/>\n";
echo " <input type=\"text\" name=\"lname\" value=\"".$row['lname']."\"/>\n";
echo " <input type=\"text\" name=\"hca\" value=\"".$row['hca']."\"/>\n";
echo " <input type=\"text\" name=\"file\" value=\"".$row['file']."\"/>\n";
echo " <input type=\"image\" src=\"images/update.png\" alt=\"Update Row\" class=\"update\" title=\"Update Row\">\n";
echo "<a href=\"delete.php?tfid=".$row['tfid']."\"><img title='Delete Row' alt=\"Delete\" class='del' src='images/delete.png'/></a></form></div>\n";
}
echo "</table><br />\n";
和检索代码:
$tfid= isset($_GET["tfid"]) ? $_GET["tfid"] : NULL;
$fname = isset($_GET["fname"]) ? $_GET["fname"] : NULL;
$lname = isset($_GET["lname"]) ? $_GET["lname"] : NULL;
$hca = isset($_GET["hca"]) ? $_GET["hca"] : NULL;
echo $tfid;
echo $fname;
echo $lname;
echo $hca;