php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32601 Related to Bug #18648 Single entry form POST gives incorrect variable content.
Submitted: 2005-04-06 01:58 UTC Modified: 2005-05-03 11:39 UTC
From: sarah dot lee at seh dot ox dot ac dot uk Assigned:
Status: Not a bug Package: Apache related
PHP Version: 4.3.9 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sarah dot lee at seh dot ox dot ac dot uk
New email:
PHP Version: OS:

 

 [2005-04-06 01:58 UTC] sarah dot lee at seh dot ox dot ac dot uk
Description:
------------
This is related to Bug #18648 Single entry form POST gives incorrect variable content.

My problems seem to be similar to that of other users on that thread, a form with a single text box doesn't really submit if the enter button is pressed.

I'm using Apache 1.3 on Windows. In my httpd.conf, I don't have any InputFilters/OutputFilters, just 

AddType application/x-httpd-php .php

I've tried the other fixes suggested: <form ... enctype="multipart/form-data"> doesn't fix it, and nor does <input type=hidden name=spoof>.

I seem to be the only one mentioning it with Apache 1.3. Is there anything that can be done to solve it?

Reproduce code:
---------------
In an include:

    <form method="POST" action="<? echo $PHP_SELF ?>?pid=<? echo $pid ?>">
      <input type="text" size="30" maxsize="50" name="ptitle" value="">
      <input type="submit" name="submit" value="Submit">
    </form>  

In the PHP script:

if ($submit) {

...

}

Expected result:
----------------
I expect the data to be carried to the PHP script, as it would if the submit button were actually clicked.

Actual result:
--------------
The page just gets refreshed with the data before any text was entered into the text box, and enter pressed.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-06 13:51 UTC] sniper@php.net
What does this output when you press simply enter:

test.php:

<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" size="30" maxsize="50" name="ptitle" value="">
<input type="submit" name="submit" value="Submit">
</form>  
<?php var_dump($_POST); ?>
 [2005-04-06 14:23 UTC] sarah dot lee at seh dot ox dot ac dot uk
The result is:

array(1) { ["ptitle"]=> string(4) "text" } 


I found a work-around last night, using "if ($_POST) { .. }" rather than "if ($submit) { .. }", but it still doesn't explain why $submit is not recognised.
 [2005-04-06 14:26 UTC] sarah dot lee at seh dot ox dot ac dot uk
Sorry, my mistake - I misread your question.

Output is:

array(2) { ["ptitle"]=> string(0) "" ["submit"]=> string(6) "Submit" }
 [2005-04-06 18:19 UTC] sniper@php.net
There we go. You're getting just correct input.
No bug here. (ALWAYS use the superglobals $_GET, $_POST, etc)

 [2005-04-06 19:08 UTC] sarah dot lee at seh dot ox dot ac dot uk
Sorry to confuse, but I've just discovered someting new.

When simply pressing enter:

array(2) { ["ptitle"]=> string(0) "" ["submit"]=> string(6) "Submit" } 

When pressing enter and the cursor is in the box (as is the norm when you have just finished typing something):

array(1) { ["ptitle"]=> string(0) "" }
 [2005-05-03 06:42 UTC] sarah dot lee at seh dot ox dot ac dot uk
This was marked bogus, but was my last comment taken into account?
 [2005-05-03 07:00 UTC] rasmus@php.net
This has nothing to do with PHP.  PHP just shows you what your browser is sending.
 [2005-05-03 07:52 UTC] sarah dot lee at seh dot ox dot ac dot uk
The related bug report to this seemed to indicate it was to do with PHP. Why is this any different now? I've tried the suggested solutions in Bug #18648, but unlike others there could not solve it.
 [2005-05-03 09:18 UTC] rasmus@php.net
This is simply how IE works, or doesn't work, depending on your perspective.  Try it with a browser that actually works, like Firefox.  It has nothing to do with bug #18648.

I think the easiest way to prove this to you is to get you to simply change the test case to use a GET instead of a POST so you can see exactly what the browser is sending to PHP.  On IE when you hit enter in the single text field, it just sends:  
  ptitle=
but when you click the submit button it sends:
  ptitle=&submit=Submit

This sort of question really doesn't belong in our bug reporting system.  Please use the appropriate mailing list next time.

 [2005-05-03 11:39 UTC] sarah dot lee at seh dot ox dot ac dot uk
Ok, thank you for explaining, and sorry to have taken up your time.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 12:01:32 2024 UTC