am new in php am trying to make a redirect link like when a user login successfully it will redirect he/she to login page. each time i login it will show me a blank page this is my code.
<!DOCTYPE HTML>
<?php
session_start(); // Starting Session
if (isset($_POST['submit'])) {
// Define $username and $password
$username=$_POST['username'];
$password=$_POST['password'];
// Establishing Connection with Server by passing server_name, user_id and password as a parameter
$username = "xxxxx";
$password = "xxxxxx";
$database = "xxxxxx";
$server = "xxxxxxx";
$connection = mysql_connect("$server", "$username", "") or die("can not connect to server");
// To protect MySQL injection for Security purpose
$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
// Selecting Database
$db = mysql_select_db("$database", $connection);
// SQL query to fetch information of registerd users and finds user match.
$query = mysql_query("select * from sec where password='".$password."' AND username='".$username."'", $connection);
$result = mysql_num_rows($query) or die(mysql_error());
if ($result == 1){
$_SESSION['username'] = $username;
header("Location: welcome.php");
}else{
echo "invalid user credentials";
}
}
?>