[英]PHP isset not accepting form name
当我检查它是否已设置时,我在尝试使用隐藏的输入字段来识别我的表单时遇到问题。 不知道是因为我在循环中运行表单还是什么。 我确实知道,当我为循环中的任何字段单击提交时,隐藏字段的值正在正确注册,它只是以某种方式'form1'没有注册为 isset。 有任何想法吗?
<?php
if(isset($_POST['form1']))
{
echo $_POST['cid'];
} else {echo "nope!";}
?>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" name="form1">
// gets array
$listchars = $user->getCharacterList($_SESSION['user_id']);
// loops through array
foreach($listchars as $chardata){
echo $chardata['name']; ?>
<input type="hidden" name="cid" value="<?php echo $chardata['cid'];?>">
<input type="submit" name="submit" value="submit">
<?php } ?>
</form>
表单名称未提交
利用
<input type="submit" name="form_name">
或者
<input type="hidden" name="form_name">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.