[英]Executing this PHP program?
我無法使該程序正常運行。 我確定我具有所有正確的語法,方括號等。但是,它只是吐出了放入其中的代碼,我有什么遺漏嗎?
在執行JavaScript程序之后,程序應通過post方法自行發布。
<!DOCTYPE HTML>
<html lang="EN" dir="ltr" xmin="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/xml; charset=utf-8" />
<title>Site.php</title>
</head>
<body>
<form id="myform" method="Post" action="Site.php">
<center><table><tr>
<td align="center"><input type="text" name="mo" value="<?php echo $_SESSION['mo']; ?>" size="4"/></td>
<td align="center"><input type="text" name="dy" value="<?php echo $_SESSION['dy']; ?>" size="4"/></td>
<td align="center"><input type="text" name="yr" value="<?php echo $_SESSION['yr']; ?>" size="4"/></td>
<td align="center"><input type="text" name="hr" value="<?php echo $_SESSION['hr']; ?>" size="4"/></td>
<td align="center"><input type="text" name="mn" value="<?php echo $_SESSION['mn']; ?>" size="4"/></td>
<td align="center"><input type="text" name="sc" value="<?php echo $_SESSION['sc']; ?>" size="4"/></td>
</tr</table></center>
</form>
</body>
</html>
<?php
$mo = filter_input(INPUT_POST, "mo");
$dy = filter_input(INPUT_POST, "dy");
$yr = filter_input(INPUT_POST, "yr");
$hr = filter_input(INPUT_POST, "hr");
$mn = filter_input(INPUT_POST, "mn");
$sc = filter_input(INPUT_POST, "sc");
session_start();
$_SESSION['mo'] = $mo;
$_SESSION['dy'] = $dy;
$_SESSION['yr'] = $yr;
$_SESSION['hr'] = $hr;
$_SESSION['mn'] = $mn;
$_SESSION['sc'] = $sc;
$_SESSION['count'] = $count;
session_write_close();
?>
1。 將您的session_start()移到頁面頂部。
2。 驗證您的計數變量,因為它不存在..可能是您正在從其他地方加載它,請執行isset($count) ? $count : "";
isset($count) ? $count : "";
3。 在表單中添加一個提交按鈕,以便在會話中存儲數據。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.