I am working on a web project where I want to move from one PHP page to another Php page if condition true...
In below login PHP page, I am getting username and password using $_POST[]. if both username and password got matched in (if statement) of current PHP login page then, I want to jump to another PHP page(choice.php) specified in header function below after if.
enter code here<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form method="post" action="login.php">
<div id="div1">
<h1>welcome to bizdiary</h1>
<div id="div2">
<label for="exampleInputEmail1">Username</label>
<input id="name" class="form-control" type="text" name="username" value=""
placeholder="username" />
<small id="emailHelp" class="form-text text-muted">We'll never share your
email with anyone else.</small>
<label for="exampleInputPassword1">Password</label><input id='password'
class="form-control" type="text" name="password" value=""
placeholder="password"/>
</div>
<input id='submit' type='submit' name="login" id="login_button"
value="login" class="btn btn-primary" >
</div>
</form>
<?php
if(isset($_POST['submit'])){
$username=$_POST['username'];
$password=$_POST['password'];
$s=1;
if($username=='root' && $password=='tiger'){
header( "Location:http://localhost/bizdiary/choice.php" ); die;
}
}
?>
Aucun commentaire:
Enregistrer un commentaire