$_SESSION[] not getting value
Moderator: General Moderators
$_SESSION[] not getting value
How do I do, to get values while using $_SESSION. I'am unable to get any values?
Last edited by Sam2010 on Wed Dec 09, 2009 6:59 am, edited 2 times in total.
- Grizzzzzzzzzz
- Forum Contributor
- Posts: 125
- Joined: Wed Sep 02, 2009 8:51 am
Re: $_SESSION[] not getting value
what's your current code that isn't working
Re: $_SESSION[] not getting value
else {
session_start();
$_SESSION['login'] = $login;
echo 'Logged';
}
What will be the script to add, if I looking for the phone and the email?
echo "<b>Phone:</b> ".$_SESSION['phone']."<br>";
echo "<b>Email:</b> ".$_SESSION['email']."<br>";
session_start();
$_SESSION['login'] = $login;
echo 'Logged';
}
What will be the script to add, if I looking for the phone and the email?
echo "<b>Phone:</b> ".$_SESSION['phone']."<br>";
echo "<b>Email:</b> ".$_SESSION['email']."<br>";
Re: $_SESSION[] not getting value
Turn on error reporting?
Re: $_SESSION[] not getting value
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Here is the complet script:
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Here is the complet script:
Code: Select all
<?php
if(isset($_POST) && !empty($_POST['login']) && !empty($_POST['pass'])) {
extract($_POST);
$sql = "select pwd from tbl_user2 where login='".$login."'";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$data = mysql_fetch_assoc($req);
if($data['pwd'] != $pass) {
echo '<p>Mauvais login / password. Merci de recommencer</p>';
include('login.htm'); // On inclut le formulaire d'identification
exit;
}
else {
else {
session_start();
$_SESSION['login'] = $login;
echo 'Logged';
echo "<b>Login</b> ".$_SESSION['login']."<br>";
echo "<b>Phone:</b> ".$_SESSION['phone']."<br>";
echo "<b>Email:</b> ".$_SESSION['email']."<br>";
}
}
else {
echo '<p>Vous avez oublié de remplir un champ.</p>';
include('login.htm'); // On inclut le formulaire d'identification
exit;
}
?>pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Re: $_SESSION[] not getting value
Ok, I will next time.
I just start in PHP. It maybe simple but I really need help with this script.
I've tried lots of things but nothing working.
Thanks.
I just start in PHP. It maybe simple but I really need help with this script.
I've tried lots of things but nothing working.
Thanks.