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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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 Mar 28 21:01:27 2024 UTC