I'm creating a website where there's a login page. The user must enter their user and password, and if the info is correct, the web site should open/display a new site with some information. Now I'm stuck in the part where the web site will display another page, here's the form that I'm using (login.php)
<form method="POST" action="home.php" autocomplete="off">
<input name="user" id="fields" type="text" placeholder="user" required><br/>
<input name="password" id="fields" type="password" placeholder="password" required></br>
<input id="button" type="submit" value="OK"></center>
</form>
</div>
<?php
$user=$_POST["user"];
$password=$_POST["password"];
if($user=="user"&&$password=="password"){ //dummy user & psswd
echo "<script type='text/javascript'><!--window.location = 'reports_home.php'//--></script>";
}
else{
echo "<center> <p style='color:red';>".ERROR."</center>";
}
?>
And when I run login.php, everything's fine, but if enter any name or text into the fields and hit submit, the home.php file will open. But if remove action="reports_home.php
(and remove the "<script type=
part) , the page will validate the input, but it won't open the new site.
Anyone who can explain to me why this is happening or how should it be coded? If you nee more info, please let me know.