我对PHP比较新。对于我的网页,我需要在同一个页面中加载多个页面......就像我有一个名为cwt.html的基本HTML页面一样有所有的复选框和提交按钮。一旦提交按钮后,下一个页面(说processing.php)相关选定的复选框(cwt.html的)也应该在同一个页面加载..在PHP的同一页面上加载多个页面
<html>
<head>
<title> Conditions We Treat </title>
</head>
<body>
<form id = form1 action = "processing1.php" method = "post">
<input type = "checkbox" name = "sickness[]" value = "Nausea">Nausea</input><br/>
<input type = "checkbox" name = "sickness[]" value = "Constipation">Constipation</input><br/>
<input type = "checkbox" name = "sickness[]" value = "vomiting">Vomiting</input><br/>
<div id = "submit1"><input type = "submit" name = "submit" value = "submit"></input></div><br/>
</form>
</body>
</html>
一旦提交按钮当点击这个网页,控制应该前往processing1.php,但内容在同一页面
<html>
<head>
<title> Conditions We Treat </title>
</head>
<body>
<?php
echo "hi"
foreach($_POST['sickness'] as $s)
{
$con = mysqli_connect("localhost","root","","collofnursing");
//mysql_select_db("collofnursing");
$res = mysqli_query($con,"select * from condwetreat");
while($row = mysqli_fetch_array($res))
{
echo $s;?> <br><br><?php
}
}
?>
</body>
</html>
阅读关于AJAX。 – dfsq 2013-03-03 06:58:36
虽然注意到,不建立网站是没有JS支持不必要的破坏 – Eevee 2013-03-03 07:15:25