I am having an issue where after pressing submit, I am taken to a page that is all source code rather than getting logged in like I expected.
Can anyone tell me where my issue is that would be great, I'm really confused i want it working as a local page for now as I am in very early stages of development I am new to the world of coding but am trying to learn.
Source of Index.html:
<?php
session_start();
echo 'Connected successfully';
mysql_close($link);
if ($_POST['username']) {
$dbUsername = "james";
$dbPassword = "";
$uid = "1111";
$username = strip_tags($_POST["username"]);
$paswd = strip_tags ($_POST["password"]);
if (username == $dbusername && $paswd == $dbPassword){
$_SESSION['username'] = $username;
$_SESSION['id'] = $uid;
header("location: index.html");
} else {
echo "username and password not registered";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Rank Landlord</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="style.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body class="body">
<header class="mainHeader">
<div id="wrapper">
<br />
<form id="form" action="index.php" method="post" enctype="multipart/form- data">
Username: <input type="text" name="username" />
Password: <input type="password" name="password" />
<input type="submit" value="Login" name="Submit" /><br /><br />
</form>
</div>
<nav><ul>
<li class="active"><a href="#">Home</a></li>
<li><a href="xxx.html">XXX</a></li>
<li><a href="xxxx.html">XXXX</a></li>
<li><a href="xxxxxxx.html">XXXXXXt</a></li>
<li><a href="Registration.html">Registration</a></li>
<li><a href="detailed.html">XX</a></li>
</ul></nav>
</header>
<div class="mainContent">
<div class="content">
<article class="topcontent">
<header>
<h2><a href="#" rel="bookmark" title="Permalink to this POST TITLE">Who are we?</a></h2>
</header>
<footer>
<p class="xxxxxxxxx xxxxxxxxxxx</p>
</footer>
<content>
<p>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</p>
<p>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</p>
</content>
</article>
<article class="bottomcontent">
<header>
<h2><a href="#" rel="bookmark" title="Permalink to this POST TITLE">Registration</a></h2>
</header>
<footer>
<p class="post-info">Register as a free user using social media</p>
</footer>
<content>
<p>social media logos to go here, with links</p>
</content>
</article>
</div>
<aside class="top-sidebar">
<article>
<h2>quick search</h2>
<p></p>
<div id="bottomContent">
<form class="searchform cf">
<input type="text" placeholder="Find a Landlord to RANK!">
<button type="submit">Search</button>
<p> </p>
</form>
</div>
</article>
</aside>
<aside class="middle-sidebar">
<article>
<h2>Area Search</h2>
<p>
<form class="searchform cf">
<input type="text" placeholder="Postcode..."></p>
<p>
<form class="searchform cf">
<input type="text" placeholder="City..."></p>
<p>
<form class="searchform cf">
<input type="text" placeholder="County..."></p>
<p><form action="">
<select name="Within...">
<option value="01">0-1 Miles</option>
<option value="25">2-5 Miles</option>
<option value="5-10">5-10 Miles</option>
<option value="10plus">10+ Miles</option>
</select>
<p> <button type="submit">Search</button> </p>
</article>
</aside>
</form></p>
</div>
<footer class="mainFooter">
</footer>
</body>
</html>