我在理解如何使 foreach 函数工作时遇到问题。我有一个表格,它使用复选框。我尝试将它们加载为复选框数组,但我无法让 foreach 函数为我工作。我不完全理解这一切。让我快速发布我的表单数据:
<form method="post" action="interests.php" name="interests">
<table width="500" cellspacing="3" cellpadding="3" bgcolor="#FF80FF" bordercolor="#800000">
<tr>
<td><input type="checkbox" name="check1" value="1"></td>
<td><input type="checkbox" name="check2" value="2"></td>
<td><input type="checkbox" name="check3" value="3"></td>
<td><input type="checkbox" name="check4" value="4"></td>
</tr>
<tr>
<td><input type="checkbox" name="check5" value="5"></td>
<td><input type="checkbox" name="check6" value="6"></td>
<td><input type="checkbox" name="check7" value="7"></td>
<td><input type="checkbox" name="check8" value="8"></td>
</tr>
<tr>
<td colspan="2"><input type="submit"></td>
<td colspan="2"><input type="reset"></td>
</tr>
</table>
</form>
到目前为止,这是我的 php 处理器..:
<?php
for(x=1;x>8;x++){
$loop=
echo 'Your interests have been updated into the database, and those files will now</br>';
echo 'begin showing up in the files area on your files sections.';
?>
我知道,不多,因为我被困住了。我在敲我的头。我需要将其解析出来,并检查填充的值,以便将数据输入数据库。看起来很简单,但由于某种原因我无法理解!