i hav a session variable.but wen i try to access it from the other page it is not showing anything.so i think session value is not working.
------User.php-------
<?php
ob_start();
@session_start();
require_once ("check.php");
createsessions($username,$password,$userid,$projectid,$projectname,$filename,$size,$allocatedmemory,$answer,$usedmemory,$Remainingmemory,$result,$data3,$abc);
include 'connection.php';
$query= mysql_query("SELECT projectassign FROM projectassign where userid=(select userid from users where username='$username' and role='2')");
mysql_error();
$num=mysql_num_rows($query);
?>
<head>
<body>
<link rel="stylesheet" type="text/css" href="style.css"/>
<script language="javascript" type="text/javascript">
function check()
{
if(document.getElementById('radio[]').value == "")
{
alert('Please select project');
return false;
}
}
</script>
<form action="upload.php" method="post">
<table width="100%">
<tr><td><img src="Logofinalcopy.gif">
</td></tr></table><br><hr style="color: red;">
<table align="right"><tr> <td></td>
<td align="right" style="color: navy;"><strong><?php echo "Welcome ".$_SESSION[username];?>,</strong></td><td><a href="Logout.php">Logout</a></td>
</tr></table>
<br><br>
<table border="1" cellspacing="0" cellpadding="0" align="center" style="width: 500px" bordercolor="red">
<tr>
<th></th>
<th style="color: navy;">Projectassign</th>
</tr>
<?php
$sno=1;
while($row=mysql_fetch_array($query, MYSQL_ASSOC)){
?>
<tr>
<td><input name="radio" type="radio" id="radio[]" checked="checked" value="<?php echo $row['projectassign'];?>"></td>
<td><?php echo $row['projectassign'];?></td>
</tr>
<?php
$sno=$sno+1;
}
?>
</table>
<table align="center"><td align="center">
<input type="submit" name="Submit" value="Submit"></td>
</table>
</body></head>
<?php
$abc=$radio; // session $abc which i need it in the other page
?>
------upload.php-------
<html>
<script language="javascript" type="text/javascript">
function check()
{
if(document.getElementById('file').value == "")
{
alert('Please select a file');
return false
}
}
//function MyReload()
//{
// window.location.reload();
// }
</script>
<body onload="MyReload()">
<link rel="stylesheet" type="text/css" href="style.css"/>
<form enctype="multipart/form-data" action="upload2.php" method="post">
<table>
<tr>
<td><img src="Logofinalcopy.gif"></td>
</tr>
</table><br><hr style="color: red;">
<table>
<?php echo "<left> <br> <input type='button' value='back' onClick='history.go(-1)'></left>";
$a = $_SESSION['abc']; //it is not at all printing value
echo "<strong style='color:navy'>"."<center><h2> $a </h2></center>"."</strong>";
?>
<tr>
<td style="color: navy;">
<strong>Please choose a file: </strong>
</td>
<td>
<input id="file" name="uploaded" type="file"><br>
</td>
</tr>
<tr><td>
<input type="submit" value="upload" name="btn" onclick="return check()"></td></tr>
</table>
<?php
ob_start();
@session_start();
require_once ("check.php");
createsessions($username,$password,$userid,$projectid,$projectname,$filename,$size,$allocatedmemory,$answer,$usedmemory,$Remainingmemory,$result,$data3,$abc);
include 'connection.php';
$sql= "select * from files where uploadedby='$_SESSION[username]' and projectname='$_SESSION[abc]' ";
mysql_error();
$result=mysql_query($sql);
$num=mysql_num_rows($result);
$sql2="select allocatedmemory from projects where projectname='".$_SESSION[abc]."'";
mysql_error();
$d=mysql_query($sql2);
$data1=mysql_result($d,0);?>
<table><tr><td style="color: navy"><?php echo " Allocated memory ".$data1;?></td></tr><br>
<?php
$sql1="select sum(size) from files where projectname='$_SESSION[abc]'";
mysql_error();
$data=mysql_query($sql1);
$usedmemory=mysql_result($data,0,"sum(size)");?>
<tr><td style="color: navy"><?php echo "Used memory ".$usedmemory." kb"; ?></td></tr><br>
<?php
$data2=1024*$data1;
$data3=$data2-$usedmemory;?>
<tr><td style="color: navy"><?php echo " Remaining memory ".$data3." kb";?></td></tr></table>
<?php $answer = $_POST['radio'];
?>
<table border="1" cellspacing="0" cellpadding="0" align="center" style="width: 500px" bordercolor="red">
<tr>
<th></th>
<th style="color: navy;">Fileid</th>
<th style="color: navy;">Filename</th>
<th style="color: navy;">Uploadedby</th>
<th style="color: navy;">Uploadeddate(Y-M-D)</th>
<th style="color: navy;">Size(in KB)</th>
</tr>
<?php
$i=0;
while ($i < $num) {
$f=mysql_result($result,$i,"fileid");
$f1=mysql_result($result,$i,"filename");
$f2=mysql_result($result,$i,"uploadedby");
$f3=mysql_result($result,$i,"uploadeddate");
$f4=mysql_result($result,$i,"size");
?>
<tr>
<td><a href =http://localhost/Project/upload.php onclick="window.open('http://localhost/Project/download.php?f1=<?php echo $f1;?>','popup','width=550,height=400,scrollbars=no,resizable=no,toolbar=no,directories=no,location=center,menubar=no,status=no,left=370,center=0,top=300')">
download</a></td>
<td><?php echo $f;?></td>
<td><?php echo $f1;?></td>
<td><?php echo $f2; ?></td>
<td><?php echo $f3;?></td>
<td><?php echo $f4; ?> </td>
<!--<td><input type="submit" name="btn" value="Delete"</td>--></tr>
<?php
$i++;
}
?>
</table>
</form></body></html>