|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 17:00:02 2025 UTC |
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.Sorry, my mistake - I misread your question. Output is: array(2) { ["ptitle"]=> string(0) "" ["submit"]=> string(6) "Submit" }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) "" }