[ciapug] $_POST vars and html email?

David Champion ciapug@cialug.org
Tue, 11 Nov 2003 12:21:37 -0600


David Champion wrote:

> David Champion wrote:
> 
>> I have an html form like this:
>>
>> <form action="http://www.foo.com/test.php" method="POST">
>> <input type="hidden" name="foo" value="bar">
>> <input type="submit" name="btn_foo" value="btn_bar">
>> </form>
>>
>> ... and test.php says:
>>
>> <?
>> foreach ($_POST as $key1 => $value1) {
>>     echo "<br>$key1 : $value1";
>> }
>> ?>
>>
>> If open this first form in my web browser and submit it, I get the 
>> expected behavior - the page displays "foo : bar". If I then send an 
>> HTML email with the exact same form, test.php displays nothing. I also 
>> tried spitting out everthing by subsituting "$GLOBALS" for "$_POST" 
>> and there is no key called "foo" or value called "bar".
>>
>> I verified by saving the email source, then running "base64 -u ..." to 
>> decode it, and there's nothing wrong with the HTML.
>>
>> I tested with Mozilla 1.4.x and Thunderbird, as well as Outlook and 
>> they all do (or don't do) the same thing.
>>
>> Ideas?
> 
> 
> <crickets chirping> :(
> 
> Would someone be willing to put that "test.php" on their server and see 
> if we get the same results?

Thanks to Dave Crouse for putting a test up for me... I got the same 
behavior - works from an HTML form, fails from an HTML email.

I noticed that if you post it from an html form in a browser, then hit 
"reload", the browser (Mozilla anyway) warns you that it was a POST, but 
when you hit it from the email form, it does not.

Ran this by another co-worker (Garritt) and he suggested trying a "GET", 
and that does work - you have to change the $_POST to $_GET in the 
test.php above of course.

So, apparantly some (all?) email clients don't send the http post the 
way a browser does.

-dc