473,395 Members | 1,466 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,395 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 2218
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: 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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.