Session does not want to accept method value POST
. It saves the first time, but after the page is updated it disappears.
<?php
if(isset($_SESSION['b'])){
if ($_SESSION['b'] !=""){
$_POST['email'] =$_SESSION['b'];
echo $_SESSION['b']."<br/>1";
}else{
$_SESSION['b'] = $_POST['email'];
echo$_SESSION['b']."<br/>2";
}
}
else{
session_start();
$_SESSION['b'] = "";
}?>
<form name="form" action="" method="POST">
Email: <input type="email" name="email" class="email" id="email">
</div>
<input type="submit" name="enviar" id="enviar" class="enviar" value="Encurtar" />
</form>
<?php
if(isset($_SESSION['b'])){
if ($_SESSION['b'] !=""){
$_POST['email'] =$_SESSION['b'];
echo $_SESSION['b']."<br/>1";
}else{
$_SESSION['b'] = $_POST['email'];
echo$_SESSION['b']."<br/>2";
}
}
else{
session_start();
$_SESSION['b'] = "";
}?>