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

different results , same php

P: n/a
Hello.

I am just starting out in php. First I installed Apache-server in
Windows, everything worked fine. Now in Linux and php-scripts work fine,
except this one. Seems that variables cannot be transported from one
..php file to the other.

In one file I put this:

<FORM ACTION="display.php" METHOD=POST>
<INPUT TYPE="text" name="name">
<INPUT TYPE="text" name="age">
<INPUT TYPE="submit">
</FORM>
</body>
</html>

Then display.php is started when the form is submitted. In display.php:

Hi <?php echo $name?>. You are <?php echo $age?> years old.

but for $name and $age no values are give, the same script in Windows does.

Could anybody explain this to me ?

Thanks in advance.Edward

Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

On 30-Nov-2003, edward hage <ed**@xs4all.nl> wrote:
I am just starting out in php. First I installed Apache-server in
Windows, everything worked fine. Now in Linux and php-scripts work fine,
except this one. Seems that variables cannot be transported from one
.php file to the other.

In one file I put this:

<FORM ACTION="display.php" METHOD=POST>
<INPUT TYPE="text" name="name">
<INPUT TYPE="text" name="age">
<INPUT TYPE="submit">
</FORM>
</body>
</html>

Then display.php is started when the form is submitted. In display.php:

Hi <?php echo $name?>. You are <?php echo $age?> years old.

but for $name and $age no values are give, the same script in Windows
does.

Could anybody explain this to me ?


You probably have register_globals set off in the php.ini file in the linux
system and set on in the windows system.

With register_globals on the posted values are set into global variables
directly, with it off they are set into the $_POST array. If you change
$name to $_POST['name'] and $age to $_POST['age'] in display.php, your
script will work on your linux system.
--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #2

P: n/a
edward hage <ed**@xs4all.nl> writes:
I am just starting out in php. First I installed Apache-server in
Windows, everything worked fine. Now in Linux and php-scripts work fine,
except this one. Seems that variables cannot be transported from one
.php file to the other.

In one file I put this:

<FORM ACTION="display.php" METHOD=POST>
<INPUT TYPE="text" name="name">
<INPUT TYPE="text" name="age">
<INPUT TYPE="submit">
</FORM>
</body>
</html>

Then display.php is started when the form is submitted. In display.php:

Hi <?php echo $name?>. You are <?php echo $age?> years old.

but for $name and $age no values are give, the same script in Windows does.

Could anybody explain this to me ?


Sounds like your Windows box has a less secure configuration (big
surprise there, eh?). See the following section from the Security
chapter in the PHP manual:

http://www.php.net/manual/security.registerglobals.php

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Jul 17 '05 #3

P: n/a
Thanks Tom, that was the problem/solution.

Tom Thackrey wrote:
On 30-Nov-2003, edward hage <ed**@xs4all.nl> wrote:

Hi <?php echo $name?>. You are <?php echo $age?> years old.

but for $name and $age no values are give, the same script in Windows
does.

Could anybody explain this to me ?

You probably have register_globals set off in the php.ini file in the linux
system and set on in the windows system.

With register_globals on the posted values are set into global variables
directly, with it off they are set into the $_POST array. If you change
$name to $_POST['name'] and $age to $_POST['age'] in display.php, your
script will work on your linux system.


Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.