LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-07-2003, 05:30 PM   #1
lostboy
Member
 
Registered: Mar 2003
Location: Florida
Distribution: Slackware 9.1,10.1
Posts: 268

Rep: Reputation: 30
Question about php variables


What is the most convenient way to carry a variable, which was defined in a previous php script, into another php script?

For example, if this variable :

$dbname=$_GET['dbname'];

is defined in the present php script, how would you carry this variable to a php script which is executed next, without having to write this variable's contents to a file and read from the file ?

JC
 
Old 08-07-2003, 05:56 PM   #2
cIx
Member
 
Registered: Aug 2003
Location: /dev/null
Posts: 40

Rep: Reputation: 15
What do you mean 'executing next'? You click on a url to execute the next script, or what?
 
Old 08-07-2003, 06:19 PM   #3
lostboy
Member
 
Registered: Mar 2003
Location: Florida
Distribution: Slackware 9.1,10.1
Posts: 268

Original Poster
Rep: Reputation: 30
Sorry I left that out. The next script is called when you click a button.

script1 : enter info into a text box, click button, store variable for script 2.
script2 : enter info into a text box, click button, store variable for script 3.
script3 : use variable from script 2, and script 1.


My dilema is that I am trying to get info entered into a text box in script 1, and use it in script 3.


JC
 
Old 08-07-2003, 06:31 PM   #4
cIx
Member
 
Registered: Aug 2003
Location: /dev/null
Posts: 40

Rep: Reputation: 15
well... you can use the 'hidden' option...i.e.

<input type=hidden name=v_from_script1 value=The_VALUE>
<input type=hidden name=v_from_script2 value=The_VALUE>
...
...
<input type=submit>

then, when you get script 3 just pull them out
 
Old 08-07-2003, 06:40 PM   #5
sk8guitar
Member
 
Registered: Jul 2003
Location: DC
Distribution: mandrake 9.1
Posts: 415

Rep: Reputation: 30
yeah, the hidden button works beautifully. OR, you coudl always use session variables, whcih are global throughout the domain
 
Old 08-07-2003, 07:38 PM   #6
lostboy
Member
 
Registered: Mar 2003
Location: Florida
Distribution: Slackware 9.1,10.1
Posts: 268

Original Poster
Rep: Reputation: 30
Thanks alot for the help.

JC
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Are PHP session variables held in memory when you leave a PHP site? Locura Programming 11 11-16-2008 08:37 PM
Can I use PHP variables in javascript? nickiv Programming 1 06-07-2005 05:41 AM
Passing variables in PHP???? vous Programming 3 03-20-2003 06:03 AM
php variables not being passed on tpat Linux - Software 1 01-11-2003 03:11 PM
global variables in php champ Programming 2 10-13-2002 01:31 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration