Check this code in "lgoincheck.php": <?php session_start(); include("config.php"); $mainU=$_POST['username']; $mainP=$_POST['password']; $sql = "SELECT * FROM ztext_register WHERE username = '$mainU' AND password = '$mainP' "; $exQ=mysql_query($sql) or die(mysql_error()); $fx = mysql_fetch_array($exQ); $userid=$fx['userid']; $status=$fx['blocked']; $gateway=$fx['gatewayno']; if($status=='y') { echo '<script>location.href="blockmsg.php";</script>'; } else if(mysql_num_rows($exQ)>0) { unset($_SESSION['userid']); unset($_SESSION['username']); unset($_SESSION['gatewayid']); $_SESSION['userid']=$userid; $_SESSION['username']=$mainU; $_SESSION['gatewayid']=$gateway; echo '<script>location.href="userhome.php";</script>'; } else { echo '<script>location.href="error.php";</script>'; } ?> Check this and let me know if it works, Best of luck, Shadman Jamil ________________________________ From: srinivas pmm <malayappa@xxxxxxxxxxxxxxxxxx> To: php-objects@xxxxxxxxxxxxxxx Sent: Saturday, February 14, 2009 7:02:08 AM Subject: Re: first time session values are not seeting in variable they are setting second i replased starting with session_start() stitll not getting values plz provide some help urgent <?php session_start(); include("config.php"); $mainU=$_POST['username']; $mainP=$_POST['password']; $exQ=mysql_query("SELECT * FROM ztext_register WHERE username = '".$mainU."'" ) or die(mysql_error()); $fx = mysql_fetch_array($exQ); $userid=$fx['userid']; $username=$fx['username']; $password=$fx['password']; $email=$fx['email']; $status=$fx['blocked']; $gateway=$fx['gatewayno']; if($status=='y') { echo '<script>window.location="blockmsg.php";</script>'; } if($mainU == $fx['username']) { if($mainP == $fx['password']) { $_SESSION['userid']=$userid; $_SESSION['username']=$mainU; $_SESSION['gatewayid']=$gateway; echo '<script>window.location="userhome.php";</script>'; } else echo '<script>window.location="error.php";</script>'; } else echo '<script>window.location="error.php";</script>'; On Sat, Feb 14, 2009 at 1:25 AM, Shadman Jamil <falcon_shan@xxxxxxxxx>wrote: > in your first file "lgoincheck.php" put on top > > session_start(); > > then it will works hope so, best of luck > best of luck, > Shadman Jamil > > ________________________________ > > From: malayappa2000 <malayappa@xxxxxxxxxxxxxxxxxx<malayappa%40nannacomputers.com> > > > To: php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com> > Sent: Friday, February 13, 2009 9:59:22 PM > Subject: first time session values are not seeting in > variable they are setting second > > hi fallowing is my logincheck page > --------------------------------- > lgoincheck.php > > include "config.php"; > > $mainU=$_POST['username']; > $mainP=$_POST['password']; > $exQ=mysql_query("SELECT * FROM ztext_register WHERE username = > '".$mainU."'" ) or die(mysql_error()); > $fx = mysql_fetch_array($exQ); > $userid=$fx['userid']; > $username=$fx['username']; > $password=$fx['password']; > $email=$fx['email']; > $status=$fx['blocked']; > > echo "username db is".$username."<br>"; > echo "username db is".$userid."<br>"; > if($status=='y') > { > echo '<script>window.location="blockmsg.php";</script>'; > } > > if($mainU==$fx['username']) > { > if($mainP ==$fx['password']) > { > $_SESSION['userid']=$userid; > $_SESSION['username']=$fx['username']; > > echo '<script>window.location="userhome.php";</script>'; > } > > else > echo "password not correct"; > echo '<script>window.location="index.php?step=1";</script>'; > } > else > echo "user name not correct"; > echo '<script>window.location="index.php?step=1";</script>'; > ?> > > fallowing is user home page. > > ------------------------------- > > <?php session_start(); > include "config.php"; > $username=$_SESSION['username']; > echo "$username"."hi"; > ?> > when i try to login first time iam uable to get the username in > userhome page. > > if try to login second time i am able to login > because firts time session values are not setting . > only second time session values are setting plesae provide some help > > ------------------------------------ > > Are you looking for a PHP job? > Join the PHP Professionals directory Now! > http://www.phpclasses.org/jobs/ > Yahoo! Groups Links > > [Non-text portions of this message have been removed] > > > -- Regards malayapppa Home page : www.nannacomputers.com An ISO 9001:2000 company (This e-mail contains information from Nanna Computers, which may be privileged or confidential. The information is for the intended individual(s) or entity named above. If you are not the intended recipient be aware that any copying, disclosing, distribution or use of the above email and/or its attachments is prohibited and is illegal. If you have received this electronic message in error, please notify us by telephone or email (to the numbers or address above) immediately. This e-mail is not un-solicited e-mail under the relevant regulations) [Non-text portions of this message have been removed] ------------------------------------ Are you looking for a PHP job? Join the PHP Professionals directory Now! http://www.phpclasses.org/jobs/ Yahoo! Groups Links [Non-text portions of this message have been removed]