dimanche 27 décembre 2015

Simple session example not working

I writed this little session script and i saw that's not working.

<?php
  session_start();
  $username = $_SESSION["username"];
?>

  <html><head>
  <title>Simple Session Example</title>
  </head>
  <body>

<?

  if(isset($_SESSION['username'])) {
  $username = $_POST["username"];
  echo "<h3>Hello $username</h3>";
  }

  else {
  echo "<h3>OUT!</h3>"; 
  echo "<form action='index.php' method='POST'>";
  echo "<input type='text' name='username'>";
  echo "<input type='submit' name='submit' value='Submit'></form>";
  }

  ?>

I can't figure out which part is wrong. looks all good for m but definatelly something is wrong.

Aucun commentaire:

Enregistrer un commentaire