-3
To Session does not want to accept the method value POST
. She saves the first time, but after the page is updated she 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'] = "";
}?>
When you enter the first If, Session is not startled
– edson alves
I put but messmo so n worked
– romulo henrique
Pq vc assigns the value of Session to the post? $_post['email'] = $_Session['b']
– edson alves
Remove all the
session_start();
and addsession_start();
only once in the second line of your code (right after the first<?php
)– Valdeir Psr