-3
所以我創建了一個表單,用戶輸入一個姓名和出生日期。在用戶按下「提交」之後,我希望表單保持在頂部;現在它老是拖延的形式在頁面的底部時,按提交,並也擺脫按下提交以及之後在頁面頂部的「搜索病人後:PHP輸出顯示HTML內容以上
<html>
<head>
<form action="test.php" method="post" name="searchform">
<table>
<tr>
<td>Name: </td>
<td><input type = "text" name = "fullname" placeholder="First and Last name" style ="color:#888;" required/></td>
</tr>
<tr>
<td>Date of Birth: </td>
<td>
<select name = "month" required>
<option value = "jan">Januray</option>
<option value = "feb">Feburary</option>
<option value = "mar">March</option>
<option value = "apr">April</option>
<option value = "may">May</option>
<option value = "jun">June</option>
<option value = "jul">July</option>
<option value = "aug">August</option>
<option value = "sep">September</option>
<option value = "oct">October</option>
<option value = "nov">November</option>
<option value = "dec">December</option>
</select>
<select name = "day" required>
<option value = "01">01</option>
<option value = "02">02</option>
<option value = "03">03</option>
<option value = "04">04</option>
<option value = "05">05</option>
<option value = "06">06</option>
<option value = "07">07</option>
<option value = "08">08</option>
<option value = "09">09</option>
<option value = "10">10</option>
<option value = "11">11</option>
<option value = "12">12</option>
<option value = "13">13</option>
<option value = "14">14</option>
<option value = "15">15</option>
<option value = "16">16</option>
<option value = "17">17</option>
<option value = "18">18</option>
<option value = "19">19</option>
<option value = "20">20</option>
<option value = "21">21</option>
<option value = "22">22</option>
<option value = "23">23</option>
<option value = "24">24</option>
<option value = "25">25</option>
<option value = "26">26</option>
<option value = "27">27</option>
<option value = "28">28</option>
<option value = "29">29</option>
<option value = "30">30</option>
<option value = "31">31</option>
</select>
<input type="number" name="year" maxlength="4" placeholder="YYYY" p="[0-9]{4}" style="color:#888;" required/>
</td>
</tr>
<tr>
<td></td>
<td>
<input type = "submit" name = "submit">
</td>
</tr>
</form>
</head>
<body>
<h2>Search Patient:</h2><br />
<?php
ob_start();
if(isset($_POST['submit'])){
//header('Content-type: image/jpeg;');
$name = $_POST['fullname'];
echo "Patient Name: ".$name;
echo "<br />";
$gender = $_POST['gender'];
echo "Gender: ".$gender;
echo "<br />";
$dob = $_POST['dob'];
echo "DOB: ".$dob;
echo "<br />";
$height = $_POST['height'];
echo "Height: ".$height;
echo "<br />";
$weight = $_POST['weight'];
echo "Weight: ".$weight;
echo "<br />";
$q6 = $_POST['q6'];
echo "Reason for visit: ".$q6;
echo "<br />";
$q7 = $_POST['q7'];
echo "Any metals in body: ".$q7;
echo "<br />";
$q8 = $_POST['q8'];
echo "The following applies to child: ".$q8;
echo "<br />";
$q9 = $_POST['q9'];
echo "Child's breathing condition(s): ".$q9;
echo "<br />";
$q10 = $_POST['q10'];
echo "Child's cardian history: ".$q10;
echo "<br />";
$q11 = $_POST['q11'];
echo "Neurology: ".$q11;
echo "<br />";
$q12 = $_POST['q12'];
echo "The child is under 4 years old and the following applies: ".$q12;
echo "<br />";
$q13 = $_POST['q13'];
echo "Sleeping habits(s)/pattern(s): ".$q13;
echo "<br />";
$q14 = $_POST['q14'];
echo "Child is diagnosed with the following: ".$q14;
echo "<br />";
$q15 = $_POST['q15'];
echo "Child's birth history: ".$q15;
echo "<br />";
$q16 = $_POST['q16'];
echo "Child's weight: ".$q16;
echo "<br />";
$q17 = $_POST['q17'];
echo "Child was recently: ".$q17;
echo "<br />";
$q18 = $_POST['q18'];
echo "Current Prescription(s): ".$q18;
echo "<br />";
}
ob_end_flush();
?>
</body>
</html>
之前提交
提交後
無效的HTML - 的''
標記是元數據 https://www.w3schools.com/html/html_head.asp –