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:[EMAIL PROTECTED] 
> Sent: Wednesday, May 12, 2004 11:48 PM
> To: [EMAIL PROTECTED]
> 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
> 

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to