Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Configure PHP for passing variables

Status
Not open for further replies.

atropozzz

Programmer
Mar 19, 2002
16
AT
ciao!

the following problem: on my development system the passing of variables functions properly. but when i run my site on my provider's environment php scripts execute as they should but it is not possible to pass variables from one page to another. (for example: href="site2.php?var=value" -> it is not possible to obtain the value of $var on site2.php)

is there a special config feature my provider has to set?

thanks in advance!

atro
 
Your provider probably has register_globals set to off. This way you have to access GET variables (script.php?var=value&var2=value2...) using the $_GET array. If you use POST (forms mostly), you have to use the $_POST array. To access the var URL variable, use $_GET['var'] instead of $var. //Daniel
 
Daniel

I am very new to PHP. I have had the same problem as atro described. Your suggested fixed the issue.

thanks

arenine
 
If your calling the same script over and over, couldn't you just put your variables in your form as hidden fields and then retrieve them with:

echo(&quot;<form name=frmVars>\n&quot;);
while (list($name, $value) = each($HTTP_POST_VARS)) {
echo (&quot; <input type=\&quot;hidden\&quot; value=\&quot;$value\&quot; name=\&quot;$name\&quot;>\n&quot;);
}
echo &quot;</form>\n&quot;;


Paul Wesson, Programmer/Analyst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top