LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Question about php variables (https://www.linuxquestions.org/questions/programming-9/question-about-php-variables-79964/)

lostboy 08-07-2003 05:30 PM

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

cIx 08-07-2003 05:56 PM

What do you mean 'executing next'? You click on a url to execute the next script, or what?

lostboy 08-07-2003 06:19 PM

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

cIx 08-07-2003 06:31 PM

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

sk8guitar 08-07-2003 06:40 PM

yeah, the hidden button works beautifully. OR, you coudl always use session variables, whcih are global throughout the domain

lostboy 08-07-2003 07:38 PM

Thanks alot for the help.

JC


All times are GMT -5. The time now is 12:25 AM.