[英]PHP - How do you get the content of an html input without submitting the form?
在我的程序中,href重定向到另一个带有$ id的页面,我可以编辑该页面中带有该id的行(signoutteacher.php)。 不,我也希望能够从输入框传输位置,但我需要一个按钮来执行此操作。 有没有人知道如何只使用一个按钮来做两件事?
while ($row = mysqli_fetch_array($result)){
$id = $row['id'];
if ($row['status']== "In"){echo "<tr class='w3-hover-green w3-large'>";
echo "<td width='10%'>".$row['name']."</td>";
echo "<td width='10%'>".$row['surname']."</td>";
echo "<td width='5%'>".$row['status']."</td>";
echo "<td width='20%'><form action='Teacher.php' method='post'><input type='text' name='location'></form></td>";
$location=$_POST['location'];
echo "<td width='10%'>"."
<a href='signoutteacher.php?myId=".$id."&myLocation=".$location."' class = 'w3-btn w3-input w3-green w3-round-jumbo'>Sign Out</a>
</td>";
echo "</tr>";
表格标题已经打印出来,其他一切工作正常,不考虑位置。 错误消息表明未定义索引“位置”。 我知道我需要提交输入,但是如何?
我没有在网址中包含$ id,而是创建了一个表单,其中$ id是一个隐藏的输入,并将其与位置一起发送到表单。 现在一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.