By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,046 Members | 1,244 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,046 IT Pros & Developers. It's quick & easy.

How to call value in different programs in PHP

P: 9
I make the value of in and out as global that is being input by the user in link1.php. This value should compare to the database before storing. If there are no equal value in the database it will go to link2.php. In this page, the user will input value through option button and then click ok. After that ,user must input his name and age in the link3.php. In this page link 3.php, I want all the value being input from link 1 to link 3 will be stored in the database if the user will click ok in the link3.php.

My problem is, only the data in link3.php are being stored in the database. Value from link 1 and link 2 are not stored. How can I call these value using global?

Hope you can help
Jan 23 '07 #1
Share this Question
Share on Google+
1 Reply


ronverdonk
Expert 2.5K+
P: 4,258
You can pass variables between scripts via the $_SESSION global array. To use that you need to start each script requiring to access the value, with the session_start() command. After that you can simply store a value in the array, e.g.[php]<?php
session_start();
$_SESSION['myvalue'] = "value";[/php]
In another script you can get the value back e.g.[php]<?php
session_start();
$value = $_SESSION['myvalue'];[/php]
See also thread How to pass a same variable across mutiple pages using sessions in this forum with a discussion on this subject.

Ronald :cool:
Jan 23 '07 #2

Post your reply

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