Dea Friends,
it is superb serveice you are doing....lets please talk about SESSION in PHP.My code is below.
<!DOCTYPE html>
<?php session_start(); ?>
<html>
<head>
<title>Login page</title>
</head>
<h1 style="width: 20%" >Login Page</h1>
<fieldset style="width: 30%"> <legend style="background: #59CC57" >Login</legend>
<body style="background: #B6ECEB">
<form method="post" >
Username:<input type="text" name="username" placeholder="username" /> <br></br>
Password:<input type="password" name="password" placeholder="********" /><br></br>
<input type="submit" name="login" value="login" /> <br></br>
</form>
<?php
include"conn.php";
$errormsg="";
if(isset($_POST['login'])){
//$uname= $_POST['username'];
//$pword= $_POST['password'];
$uname = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_SPECIAL_CHARS);
$pword = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_SPECIAL_CHARS);
$sql = $conn->prepare("SELECT * FROM login1 WHERE L1 = ? AND L2 = ?");
$sql->bind_param('ss', $uname, $pword);
$sql->execute();
$sql->store_result();
//$result=$conn->query($sql);
if($sql->num_rows>0){
//echo("welcome");
$_SESSION['User']=$uname['username'];
$_SESSION['Passw']=$pword['password'];
header("location:welc.htm");
}
else {
echo ("invalid username"."<br>");
}
}
?>
</body>
</fieldset>
<br>For new user: Please, <a href="reg.php">click</a> here...</br>
</html>
This is Logion page code i started Session and saved session variables $_SESSION['User']=$uname['username']; and $_SESSION['Passw']=$pword['password'];..i want to display username in next page welc.php but it shows on first word of the username.what is problem here?