我對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