【发布时间】:2014-01-03 22:11:55
【问题描述】:
PHP 表单代码:
echo '<form name="planeSeat" action="koltuk-sec-process.php" method="post" >';
...
echo '<input type="checkbox" class="css-checkbox" id="'.$rightplace.'" name="artwork" value="'.$rightplace.'" />';
...
echo '<input type="submit" name="formSubmit" value="Üye girişi yapmadan devam et"/>';
PHP 进程代码:
$rest1 = array();
$rest2 = array();
$rest1[] = htmlspecialchars($_POST["artwork"]);
$rest2[] = htmlspecialchars($_POST["artwork2"]);
if($rest1 != null){
print_r ($rest1);
}
if($rest2 != null){
print_r ($rest2);
}
当我发送艺术品时,如果我选择了 2 个复选框,$rest1 只保留最后一个值。如何发送我的所有值?
【问题讨论】:
-
显示您的完整表单代码,以便我们届时为您提供帮助。
-
也许您应该在表单复选框名称中使用
artwork[]而不是artwork -
使用
isset()insted of!= null并从$rest1[],$rest2[]中删除[] -
我试过艺术品[]没用
-
@MarkBaker:猜对了,但不会导致
artwork2then