473,408 Members | 1,907 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,408 software developers and data experts.

How to pass a same variable across mutiple pages using sessions

hi
i cant pass a same variable to multiplepages...
while passing variables in sessions
it shows warning and it doesn't pass to multiple pages
here the coding which i hve used
Registration.php
<?
session_start();
session_register("username");
$username=$_POST['t3'];
?>
Registration1.php
<?
session_start();
echo "".$username;
?>
update.php
<?
session_start();
echo "".$username;
$q1="UPDATE `realtour` SET list='$protype' where uname='$username'";
?>

in the above....
i cant get the value of username where used in Registration1.php
can anyone suggest me
Jan 23 '07 #1
3 2220
ronverdonk
4,258 Expert 4TB
Passing variables can best be done via the $_SESSION array.
If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled.
So in your case it is best to code as follows:
[php]Registration.php:
------------------
<?php
session_start();
$username=$_POST['t3'];
$_SESSION['username'] = $username;

Registration1.php:
------------------
<?php
session_start();
echo $_SESSION['username'];

update.php:
-----------
<?php
session_start();
$username = $_SESSION['username'];
echo $username;
[/php]

Ronald :cool:
Jan 23 '07 #2
Hi
thanks for ur suggestion
its working well
Jan 24 '07 #3
ronverdonk
4,258 Expert 4TB
You are most welcome.

Ronald :cool:
Jan 24 '07 #4

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

Similar topics

5
by: John | last post by:
I would like to pass array variables between URLs but I don't know how. I know its possible with sessions, but sessions can become useless if cookies are disabled. I have unsuccessfully tried...
2
by: | last post by:
We just learned that a variable declared Friend within a module can be shared across multiple user sessions. Is there any way to declare a Friend variable within a module, so that it is...
1
by: AnthonyC | last post by:
I am having a problem tracking down what I believe to be a problem with the way cookies are being used on our website application. When user log onto the application, an in-memory (per-session)...
5
by: David++ | last post by:
Hi folks, I would be interested to hear peoples views on whether or not 'pass by reference' is allowed when using a Web Service method. The thing that troubles me about pass-by-reference into...
4
by: igotyourdotnet | last post by:
Is there a way to pass data from page to page without the use of a Session Variable or queryString? I need to pass drop down box selections from page to page and have the drop downs on the page be...
3
by: bob.abrahamian | last post by:
Hi All. I found several threads about this specific issue here, but could not find a solution to my specific problem. Most of the threads suggested that there would be a difference between...
7
by: Gladen Blackshield | last post by:
Hello All! Still very new to PHP and I was wondering about the easiest and simplest way to go about doing something for a project I am working on. I would simply like advice on what I'm asking...
13
Frinavale
by: Frinavale | last post by:
One of the most fundamental topics in web design is understanding how to pass information collected on one web page to another web page. There are many different ways you could do this: Cookies,...
3
by: hon123456 | last post by:
Dear all, I have a session variable session("loginid) which can be passed from A.asp to B.asp. Then In B.asp I have a hyperlink to C.asp e.g. < A href..C.asp>. The session variable cannot be...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.