• 0

Redirect after form


Question

<?php

session_start();

$username=$_POST['username'];
$password=$_POST['password'];

if($username&&$password)
{

    $connect = mysqli_connect("localhost", "root", "", "login") or die("Couldnt connect to Database");
 $query = mysqli_query($connect, "SELECT * FROM users WHERE username='$username'");
 
 $numrows = mysqli_num_rows($query);
 
 if($numrows!==0)
 {
  while($row = mysqli_fetch_assoc($query))
  {
   $dbusername = $row['username'];
   $dbpassword = $row['password'];
  }
  if($username==$dbusername&&$password==$dbpassword)
  {
   echo "You are logged in!";
   $_SESSION['username'] = $username;
  }
  else
  echo "Your password is incorrect!";

    }
 else
   die("That user dosnt exist!");
}
else 
   die("Please enter a username and password");
?>

 

How DO i get this to redirect after checking the database ?

Link to comment
https://www.neowin.net/forum/topic/1301270-redirect-after-form/
Share on other sites

1 answer to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.