-1

i have a problem with PHP and HTML, I want a link to redirect to a PHP page for a login form, doing like so: <p><a href="LoginPage.php">Login</a></p> redirect the browser to the file, but it shows just the code, without showing the form, is there something that i'm missing?

the link is referring to a PHP script, the code is this:

<?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>

This is what i get when clicking the login link on the main webpage:

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

1 Answers1

0

Executing PHP is done by a server. When no server is running/installed your browser will most likely just show the contents of that file. You'll need something like WAMP (windows), XAMPP (linux) or MAMP (osx).

Daniel Gelling
  • 892
  • 1
  • 9
  • 22