|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16049 Hidden Form fields do not POST/GET after include()
Submitted: 2002-03-13 17:01 UTC Modified: 2002-03-13 17:28 UTC
From: kbritton at appliedmfg dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.1.2 OS: Linux
Private report: No CVE-ID: None
 [2002-03-13 17:01 UTC] kbritton at appliedmfg dot com
Variables set using hidden form fields are not submitted with the form when the <INPUT> tag appears AFTER an include statement.

For instance

   if (isset($var2)) {
       echo('Var2 = '.$var2);
   echo("<form method='post' action='$PHP_SELF'>");
   echo("<input type='hidden' name='var1' value='foo'>");
   include ('myfile.php');
   echo("<input type='hidden' name='var2' value='baz'>");
   echo("<input type='submit'>");

...will not send $var2 on post.  Same thing with GET.  Var1 comes through ok, though.

I've checked the script that is include-d.  Var2 is not addressed.

Is this just me?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-13 17:04 UTC] kbritton at appliedmfg dot com
Forgot to add something.  The second variable (var2) won't even show up as a form element.  If you add a javascript to the bottom of the page that shows the form elements (document.forms[0].var2.value), it doesn't display.
 [2002-03-13 17:05 UTC]
double-check the html that is output by the include file. this almost certainly has nothing to do with php.
 [2002-03-13 17:07 UTC] kbritton at appliedmfg dot com
The page outputs fine.  The include file parses EXACTLY as it is supposed to....and code BELOW the form element also parses ok (subsequent includes and other html elements).  It's just the form element that's affected.

Still searching....
 [2002-03-13 17:28 UTC] kbritton at appliedmfg dot com
Bah!  You were right.  Turns out the include file had a </form> tag in it.  

MAN I feel stupid.  I just wish I hadn't spent all day trying to fix the frelling thing.

Close me out but good.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Mar 26 00:03:53 2023 UTC