php.net |  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
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: kbritton at appliedmfg dot com
New email:
PHP Version: OS:

 

 [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

<?php
   if (isset($var2)) {
       echo('Var2 = '.$var2);
       exit();
   }
   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'>");
   echo("</form>");
?>

...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?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] jimw@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 06:01:28 2024 UTC