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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XP-Apache-Php

Status
Not open for further replies.

tzzdvd

Programmer
Aug 17, 2001
52
IT
Hi,
I was working on win2k with apache-php and everything has gone well.
Now I am using XP-Pro and I made everything as before but there is a problem:
I used this line to load a page sending a parameter ($What=First)with different languages.

echo &quot;<a href=\&quot;home.php?lng=eng&What=First\&quot;>English</a>&quot;;
echo &quot;<a href=\&quot;home.php?lng=ita&What=First\&quot;>Italian</a>&quot;;


with at the beginning of the home.php

switch ($lng)
{
default:
case &quot;ita&quot;:
include(&quot;./languages/ita.php&quot;);
break;

case &quot;eng&quot;:
include(&quot;./languages/eng.php&quot;);
break;
}


The problem is this: I have always the Italian version I think because or php doesn't send correctly the variable $lng either apache doesn't manage this variable.

Using exactly the same code under win2k everything is ok.

Is there anybody who can help me?

Thank's a lot

P.S: in the link I use & amp ; (I write with space) instead of & as shown in this message. I don't know if it is important
 
Sounds like your CGI args are wacked out. If you use '& amp' then the language will ALWAYS be &quot;ita&quot; since that is your default and the space is probably breaking the query string.

See, CGI breaks the query string arguments out on te '&' symbol. Spaces are not allowed

Get your query string straightened out and it may fix the problem.

Try this, take the query string above (no spaces or &amp nonsense) and put it in a static page, then click the link. Does it work properly now?



 
I think the problem might be in php.ini

Check for php_track_vars in php.ini or the string --enable-track-vars in the output of php_info();

You can access $Ing using GLOBAL[$Ing].

Hope this help!

Sincerely,

Dan Grant
Lead programmer
dan at abusinesshosting dot com
 
Here is another test script I wrote:

<?

if (!isset($mio))
{
echo &quot;Variable mio is not set<br>&quot;;
$mio = 0;
}
else
{
echo &quot;Variable mio is set<br>&quot;;
}

echo $mio.&quot;<br>&quot;;

$aux = $mio + 1;

echo &quot;<br><a href=\&quot;prova.php?mio=$aux\&quot;>link</a><br>&quot;;


This should increment the variable $mio each click on the link but always $mio is not set

I couldn't find any php_track_vars or enable-track-vars in the php.ini or phpinfo() function.
I wrote & amp ; without any spaces (I used spaces only for the visualization in this page) but now I don't think the & is the real problem.

The only thing I find in the php.ini file that seems to interest is


;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;
;
; Note - track_vars is ALWAYS enabled as of PHP 4.0.3

; The separator used in PHP generated URLs to separate arguments.
; Default is &quot;&&quot;.
;arg_separator.output = &quot;&&quot;

; List of separator(s) used by PHP to parse input URLs into variables.
; Default is &quot;&&quot;.
; NOTE: Every character in this directive is considered as separator!
;arg_separator.input = &quot;;&&quot;

; This directive describes the order in which PHP registers GET, POST, Cookie,
; Environment and Built-in variables (G, P, C, E & S respectively, often
; referred to as EGPCS or GPC). Registration is done from left to right, newer
; values override older values.
variables_order = &quot;EGPCS&quot;

; Whether or not to register the EGPCS variables as global variables. You may
; want to turn this off if you don't want to clutter your scripts' global scope
; with user data. This makes most sense when coupled with track_vars - in which
; case you can access all of the GPC variables through the $HTTP_*_VARS[],
; variables.


Any ideas?

Davide
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top