Hi all, i am storing the value in session but while retrieving its showing the some other value.....totally i want this stored value in the next page .........can u help me...........
This is the code i am storing the value in session

<? 
session_start();
include('database.php');
$mailid1 = $_GET['mail_id']; 
session_register('mailid1');
echo $_GET['mail_id'];

$query1="SELECT * FROM  autoalto_mail where mail_id='".$mailid1."'";
$result = mysql_query( $query1 );
//echo mysql_num_rows($result) ;
while($row = mysql_fetch_array($result))
{ 
    echo $row['contents'];
}
mysql_close();
?>

This is the code where i am retrieving value from the session

<? 
session_start();
include("header.php"); 
include('database.php');

$mailid1 = $_SESSION['mailid1'];

echo $mailid1;


$query1="UPDATE  autoalto_mail SET flag='1' where mail_id='".$mailid1."'";
$result = mysql_query( $query1 );
//echo mysql_num_rows($result) ;

mysql_close();
?>

hi,

#
$mailid1 = $_GET['mail_id'];

session_register('mailid1');

code from where you are getting mailid
if you have mailid in autoalto_mail table then you have to write like this

$qer="select * from autoalto_mail";
	$res=mysql_query($qer);
	$num=mysql_num_rows($res);
	
	 if($num==1)
		{
			session_unregister("mailid");
			session_register("mailid");
}

Main page

session_start();
$_SESSION['mailid']=$_GET['mailid'];

Receiving page

$mailid1=$_SESSION['mailid'];

Yes I got it thanks............

my question is i can login but at next page i want retrive values associates with username and password using session.
so please help me about this question.

<?php
session_start();
$_SESSION['username'] = $_POST('username');
$_SESSION['password'] = $_POST('password');

$username = $_SESSION['username'];
$password = $_SESSION['password'];
?>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.