i have code below i want use $user and $password which LoginId and password in the html code please hel me
<?php
session_start() ;
require_once('D B.php');
function validate() {
$user = $_POST['LoginID'];
echo "$user <br>";
$password = $_POST['Password'];
echo "$password <br>";
$dbcon = new DB();
$result = $dbcon -> Check($user,$pa ssword);
if($relult){
$_SESSION['error'] = 0;
return "AddProduct.php ";
}
else{
$_SESSION['error'] = 1;
return "LoginPage.php" ;
}
}
?>
<html>
<head>
<title>Login Page</title>
</head>
<body>
<?php
if(!empty($_SES SION)){
if($_SESSION['error'] == 1){
echo "please enter correct Login ID and Password";
}
}
?>
<table border ="1">
<form action="<?php $string = validate(); print $string ;?>" method="post">
<tr>
<td>Login ID </td>
<td><input type="text" name="LoginID" size="30"/></td>
</tr>
<tr>
<td>Password </td>
<td><input type="password" name="Password" size="30"/></td>
</tr>
<tr colspan="2">
<td><input type="submit" value="Login"/></td>
</tr>
</form>
</table>
</body>
</html>
<?php
session_start() ;
require_once('D B.php');
function validate() {
$user = $_POST['LoginID'];
echo "$user <br>";
$password = $_POST['Password'];
echo "$password <br>";
$dbcon = new DB();
$result = $dbcon -> Check($user,$pa ssword);
if($relult){
$_SESSION['error'] = 0;
return "AddProduct.php ";
}
else{
$_SESSION['error'] = 1;
return "LoginPage.php" ;
}
}
?>
<html>
<head>
<title>Login Page</title>
</head>
<body>
<?php
if(!empty($_SES SION)){
if($_SESSION['error'] == 1){
echo "please enter correct Login ID and Password";
}
}
?>
<table border ="1">
<form action="<?php $string = validate(); print $string ;?>" method="post">
<tr>
<td>Login ID </td>
<td><input type="text" name="LoginID" size="30"/></td>
</tr>
<tr>
<td>Password </td>
<td><input type="password" name="Password" size="30"/></td>
</tr>
<tr colspan="2">
<td><input type="submit" value="Login"/></td>
</tr>
</form>
</table>
</body>
</html>
Comment