473,508 Members | 2,330 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

different results , same php

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
3 1685

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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2930
by: LRW | last post by:
I have a SQL string with a couple of JOINs that works perfectly in command prompt. I get results for all the fields selected just fine. But when I put it into a PHP page, I can't make variables(?)...
2
2899
by: Dave | last post by:
I'm getting different results when I display a value in the Output window as opposed to the Immediate window. Why? Code to recreate problem: 'Purpose: Get different results from Output...
3
1484
by: Tao.Young | last post by:
Hi, I met with a very strange problem: the same function will generate different results, but when i uncomment Line1, it'll get the same results. anyone can tell me why? the code is...
1
1741
by: RM | last post by:
I am using DataSet's .ReadXml() method to parse an XML file that has an inline schema and Im getting "different" results on various machines using the same myDataSet.ReadXml("myExample.xml"). ...
3
1574
by: Taylor | last post by:
Good afternoon. I have recently converted an Access 97 application to Access 2003. The conversion went rather smoothly. However I am getting different results from the same exact query. I can...
22
26673
by: silversurfer2025 | last post by:
Hello everybdy, I am a little confused for the following reason: In my code I used a simple for-loop in order to initialize a 2D-array of floats to zero. Because of efficiency reasons, I changed...
3
3631
by: Bill Hutchison | last post by:
I have a query that returns different results (3508 rows for snapshot, 6288 for dynaset) and that is the only thing I change to get the different results. When I try to make a table from the...
6
1925
by: Avi | last post by:
I need to implement the following calculation: f = (a*b) + (c*d) where a,b,c,d are given double values and f is a double variable for the result I found out that using two different...
87
3649
by: pereges | last post by:
I have a C program which I created on Windows machine. I have compiled and executed the program on windows machine and it gives me the consistent output every time i run it. for eg. input a = 2,...
5
2535
by: Christopher Brewster | last post by:
I am running the same script on the same data on two different machines (the folder is synchronised with Dropbox). I get two different results. All the script does is count words in different...
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7133
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5643
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
435
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.