p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: Form Method=POST in PHP3 vs PHP4


Message #1 by "Dave Brown" <dave@m...> on Sun, 9 Feb 2003 22:25:42
I have a number of PHP3 scripts which pass variables from a form on one 
page (send.php3) to a form on another (receive.php3) via form 
method='post'. These work fine on my commercial web server that supports 
both PHP 3 and 4.

When I change the script names to send.php4 and receive.php4 (in order to 
use other PHP4 only functions) the variable values are unknown to 
receive.php4.

If I change the form method='post' to form method='get' (so I can see what 
is being sent), the variable value is null. And, yes, I did change the 
form action='receive.php4', too.

Any ideas/sugestions?

TIA

Message #2 by esanchez@g... on Tue, 11 Feb 2003 03:41:55
It will help to know which webserver you're using.
Anyway, the .php4 extension seems to be deprecated now...
In my case I only use the extension .php
regards,
   -eduardo s.m.
Message #3 by "Nikolai Devereaux" <yomama@u...> on Tue, 11 Feb 2003 10:59:05 -0800
> I have a number of PHP3 scripts which pass variables from a form on one
> page (send.php3) to a form on another (receive.php3) via form
> method='post'. These work fine on my commercial web server that supports
> both PHP 3 and 4.
>
> When I change the script names to send.php4 and receive.php4 (in order to
> use other PHP4 only functions) the variable values are unknown to
> receive.php4.
>
> If I change the form method='post' to form method='get' (so I can see what
> is being sent), the variable value is null. And, yes, I did change the
> form action='receive.php4', too.
>
> Any ideas/sugestions?


PHP v > 4.1.0 (or maybe it was 4.2.0, I fergit) turned off register_globals by
default.  Your PHP3 scripts automatically COPY form field values into global
scope.  This has some security drawbacks, so the feature is disabled.

You can turn it back on in php.ini, but I suggest you leave it off and fix
your scripts.  More info can be found in my FAQ entry:

http://p2p.wrox.com/archive/beginning_php/2002-11/17.asp


take care,

Nik

Message #4 by esanchez@g... on Wed, 12 Feb 2003 14:47:50
adding to Nicolai's post, you can reference those variables in the way:
$_POST['your_var']
or
$_GET['your_var']

depending on your case...
regards,
   -eduardo s.m.

  Return to Index