PHP isset 不接受表单名称

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">