Hi Friends
i need help in sessions
im passing variables between pages using sessions
this is the main page thats mean the home page
the main page have table to show messages for users , it have also the site style
<?
session_start();
echo
<html>
<title>WWW.EGYHK.COM</title>
<body>
<center>
<table wisth='100%' height='500' border='1' cellpadding='0' callspacing='0'>
<tr><td>$maintopic</td></tr>
</table></center>
</body>
</html>
";
?>
and i have another page named functions.php that setting the session, it have this code
<?
function showmsg($msg){
session_start();
session_register("maintopic");
$maintopic=$msg;
header("location:main.php");
}
?>
the third page is login.php , this code
<?
switch($do){
case "login":
if((!$username)||(!$password)){
showmessage("Error<br>Supply Empty Fields");
}
if(($username!='abdoelmasry')||($password!='$amiab do95245ra!@')){
showmessage("Not Valid Login Info");
}}
echo "
<html>
<body>
<form name='login' action='login.php?do=login' method='post'>
<input type='textbox' name='username' value='username'><br>
<input type='password' name='password'><br>
<input type='submit' value=' login '></form>
</body>
</html>
";
?>
if the username or password empty it will send the message (Error<br>Supply Empty Fields)
to function showmsg() to set the session variable the send header to main page
that will write the session value
but i cannot read session from another page
it can be readed in functions.php
i think the function showmsg() not setting global session
i need help to set session from showmsg function , then read session in another page
i hope i could explain
Please read the Posting Guidelines before you post in this forum! Especially the part about enclosing your code with tags
moderator.