RE: [PHP-WIN] I've found the cause of the error but I cant fix it.
| From: | Gryffyn, Trevor | Date: | Thu, 13 May 2004 17:08:04 +0000 |
| Subject: | RE: [PHP-WIN] I've found the cause of the error but I cant fix it. | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-23710@lists.php.net to get a copy of this message | ||
It sounds like a fairly common problem. You probably want to check the entry in your PHP.INI file:
register_globals = Off
You might have had it turned ON before in which case you wouldn't have to use $_POST or $_GET
to get the values of the variables, they're automatically assigned to whatever the $_POST or
$_GET variable name is.
For security reasons, you really should set it to OFF (as illustrated above). Sample code/example
follows:
------------- Before Reinstall (assuming "register_globals = ON") ---------------
HTML:
<input type="text" name="testvariable" value="50">
PHP:
Echo "Value of testvariable is: $testvariable";
Output: Value of testvariable is: 50
------------- After Reinstall (assuming "register_globals = OFF") ----------
HTML:
<input type="text" name="testvariable" value="50">
PHP:
Echo "Value of testvariable is: $testvariable";
Output: Value of testvariable is:
(no value is present in $testvariable because it's not automatically assigned when
"register_globals" is turned off)
------------- After Reinstall ("register_globals = OFF") ----------
HTML:
<input type="text" name="testvariable" value="50">
PHP:
$testvariable = $_REQUEST["testvariable"];
Echo "Value of testvariable is: $testvariable";
Output: Value of testvariable is: 50
(no value is present in $testvariable because it's not automatically assigned when
"register_globals" is turned off)
Try something like that.
-TG
> -----Original Message-----
> From: Alejandro César Garrammone [mailto:agarrammone@afip.gov.ar]
> Sent: Thursday, May 13, 2004 12:39 AM
> To: Gryffyn, Trevor
> Cc: php-windows@lists.php.net
> Subject: Re: [PHP-WIN] I've found the cause of the error but
> I cant fix it.
>
>
> I understands you well but the problem is a week ago with a
> OS Win98 all the pages funcioned very well, but when I install
> WinXP, and configure the mysql, apache and php and I tested with
> the same pages I've used on W98 it's not working.
> Where is the configuring problem?
>
> If you need some of the files like php.ini and httpd.conf,
> tell me and I'll send you those files.
>
> Thxs for helping me!!!
>
> Alex
> ----- Original Message -----
> From: "Gryffyn, Trevor" <TGryffyn@air-cargo-inc.com>
> To: <php-windows@lists.php.net>
> Cc: "Alejandro César Garrammone" <agarrammone@afip.gov.ar>
> Sent: Thursday, May 13, 2004 1:18 PM
> Subject: RE: [PHP-WIN] I've found the cause of the error but
> I cant fix it.
>
>
> If you're used to running on a system with register_globals
> turned ON then
> you might run into a snag with something like this since the
> GET and POST
> values aren't automatically assigned to the variables you're
> trying to echo.
>
> You need to do:
>
> $variablename = $_GET["variablename"];
>
> Or...
>
> $variablename = $_POST["variablename"];
>
> Or..
>
> $variablename = $_REQUEST["variablename"];
>
>
> The last one (REQUEST) will populate the $variablename
> variable with either
> GET or POST data so can be used for either. I forget the
> order that it
> takes it though, I believe it essentially does:
>
> If (isset($_POST["variablename"])) $variablename =
> $_POST["variablename"];
> If (isset($_GET["variablename"])) $variablename =
> $_GET["variablename"];
>
> (or vice versa)
>
> So if both $_POST["variablename"] and $_GET["variablename"]
> are both set,
> then the data stored in the GET overwrites the POST data
> previously assigned
> to $variablename.
>
>
> It IS possible to pass both POST and GET data at the same time:
>
> <form action="index.php?GETVARIABLE=testget" method="POST">
> <input type="text" name="POSTVARIABLE" value="testpost">
> </form>
>
>
> Var_dump($_REQUEST) will have both GETVARIABLE and POSTVARIABLE values
> ("testget" and "testpost" respectively) available where as
> $_GET only has
> the GETVARIABLE value ("testget") and $_POST only has the
> POSTVARIABLE value
> ("testpost")
>
> -TG
>
>
>
> > -----Original Message-----
> > From: Alejandro César Garrammone [mailto:agarrammone@afip.gov.ar]
> > Sent: Wednesday, May 12, 2004 11:48 PM
> > To: php-windows@lists.php.net
> > Subject: [PHP-WIN] I've found the cause of the error but I
> > cant fix it.
> >
> >
> > Hi all,
> > The problem is the GET and the POST method.
> > I've create a simple form and I pass my name on it, on the
> > other hand, on the file referenced in the form, I put an echo
> > with the variable, and it doesn't print it. (I use GET, on
> > the link it shows it, but the variable is empty).
> >
> > How can I fix it?
> >
> > Best Regards,
> >
> > Alex
> >
>
>
>