[英]PHP isset not accepting form name
I am having an issue trying to get my form with a hidden input field to be recognized when I check if it isset.当我检查它是否已设置时,我在尝试使用隐藏的输入字段来识别我的表单时遇到问题。 Not sure if it is because I am running the form in a loop or what.不知道是因为我在循环中运行表单还是什么。 I do know when I click submit for any of the fields from the loop the value of the hidden field is registering properly, it is just somehow the 'form1' is not registering as isset.我确实知道,当我为循环中的任何字段单击提交时,隐藏字段的值正在正确注册,它只是以某种方式'form1'没有注册为 isset。 Any ideas?有任何想法吗?
<?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>
The form name is not submitted表单名称未提交
Use利用
<input type="submit" name="form_name">
or或者
<input type="hidden" name="form_name">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.