0

So, I created this login page that works with a session. Now I have this problem whenever I hit the f5 button to refresh the page I always get a pop up that asks if I am sure that I want to resend the data ( of the session I assume ) again. How can I prevent this pop up from happening?

This is the session:

<?php
session_start();

if ( isset($_POST['user']) || isset($_POST['pass'])) {

    $_SESSION['user'] = $_POST['user'];
    $_SESSION['pass'] = $_POST['pass'];
} else { 
   echo "username or password not specified";
}
    $DB_user = $_SESSION['user'];
    $DB_pass = $_SESSION['pass'];
?>
Script47
  • 14,230
  • 4
  • 45
  • 66
ltv
  • 189
  • 1
  • 1
  • 7

1 Answers1

1

you are submitting the form to same page and do not redirecting to any other or same page, so it asks to post the input value again on each time you refresh the page.
you can fix this by redirect to the same page after your php stuff.

header('location:index.php');

replace index.php with your page name

cake_dev
  • 23
  • 3