473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Help , i cann't Read session value in another page

abdoelmasry
104 100+
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.
Jan 21 '07 #1
3 2591
subash
33
Hi,


I think you need to use $_SESSION['variable_name'] in your code. And you need to give the command session_start on each of the page, where you needed the session variable

Please refer http://in2.php.net/session_start

Subash :)
Jan 21 '07 #2
abdoelmasry
104 100+
Thank you Much subash

but what is the changes between

session_register("variable");
and
$_session["variable"];

???

could You Help ?
Jan 22 '07 #3
abdoelmasry
104 100+
Sorry moderator
Will Not Repead Again

Abdo Elmasry
Feb 10 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Mimi | last post by:
Hello, I am having trouble using the session vars in PHP 4.3.9 OS: Win XP Prof Web Server IIS (is local and there are no links to other servers from the web pages I work on) Browser: IE 6.0 ...
3
by: Trogdor | last post by:
I set up a server on an AMD 650 machine running gentoo linux. I installed Apachie 2, MySQL 4.1 and PHP 4.3.11 I use another computer on my local net (192.168.0.x) to access the server as a...
6
by: -D- | last post by:
I'm trying to accomplish the following. I'm trying to get the values for the table rows that are dynamically created to persist through a redirect. Referring URL:...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
10
by: Brian Conway | last post by:
I have no idea what is going on. I have a Login screen where someone types in their login information and this populates a datagrid based off of the login. Works great in debug and test through...
1
by: Mike Hofer | last post by:
I really need some help, and I'd appreciate any that you folks can provide. The ASP.NET application in question uses version 1.1 of the .NET Framework. All of the pages use a common base class...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
0
by: hshah | last post by:
Hello All, I have created a .aspx page with 7 text boxes and a save button. On click event following code is fired. It save the property information to sql server and also generate a unique Id...
1
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.