[英]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.