-1
我有PHP和HTML的一个问题,我想一个链接重定向到一个登录表单的PHP页面,这样做就像这样: <p><a href="LoginPage.php">Login</a></p>
浏览器重定向到文件,但它只是说明代码,没有显示表单,有什么我失踪?HTML重定向到PHP
链接指的是一个PHP脚本,代码是这样的:
<?php
header("location:WebPage1.html");
include('login.php');
if(isset($SESSION['login.php'])){
header("location:login.php");
}
?>
<!doctype HTML>
<html>
<head>
<title>Login PC SHOP</title>
<a href="mystyle.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="main">
<h1>Esegui il login al sito</h1>
<div id="login">
<h2>Login Form</h2>
<form action="" method="post">
<label>UserName :</label>
<input id="name" name="username" placeholder="username" type="text">
<label>Password :</label>
<input id="password" name="password" placeholder="**********"
type="password">
<input name="submit" type="submit" value=" Login ">
<span><?php echo $error; ?></span>
</form>
</div>
</div>
</body>
</html>
这是我所得到的点击主网页登录链接时:
<HTML>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
<title>
PC Shop - Home Page
</title>
</head>
<body>
<h1><a href="WebPage1.html"> PC Shop </a></h1>
<p><a href="LoginPage.php">Login</a></p>
<table border=1>
<tr>
<td>
<a href="WebPage2.html"> Carrello </a>
</td>
<td>
<a href="WebPage3.html">Area Clienti</a>
</td>
</tr>
</table>
</body>
</HTML>
如果您在浏览器中看到PHP代码,这意味着您的Web服务器未处理该代码。 PHP未正确安装或配置,或者您没有正确使用它。 – David
检查文件扩展名和顶部内部文件<?php关键字定义为 –
如果您看到代码,这是两件事之一。 1)您忘记了开头'<?php'标签。 2)你的网络服务器没有配置为识别PHP文件 – Augwa