我有以下代码:
<?php
if(isset($_POST['myCheckBox']))
{
//Checkbox1 is selected
echo "helloword 1: [".$office."]";
$checked = "checked";
}
else
{
//alternate code
echo "helloword 2: [".$office."]";
$checked = "";
}
?>
<form name="checkbox" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="checkbox" name="myCheckBox" value="<?php echo $office;?>" onClick='submit();' <?php echo $checked;?>>
</form>
如何在提交表单时更新html页面的一部分,以便整页不重新加载?这也是最好的方法吗?