php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1008 variables from form input not available to functions
Submitted: 1998-12-27 00:21 UTC Modified: 1998-12-27 00:55 UTC
From: jake at underworld dot net Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.5 OS: Linux 2.0.35
Private report: No CVE-ID: None
 [1998-12-27 00:21 UTC] jake at underworld dot net
this seems to me like a bug that someone would have noticed before i, but never the less. (feel free to flame me if this is my error.) this is part of a script that handles form input from a file called timeclock.html:

        function printenv() {
                echo $employee, "<br>\n";
                echo $passwd, "<br>\n";
                echo $punchin, "<br>\n";
                echo $punchout, "<br>\n";
                echo $task, "<br>\n";
                echo $task_other, "<br>\n";
         }

         printenv{}

it outputs this:

<br>
<br>
<br>
<br>
<br>
<br>

i have reproduced this with simpler forms, and i am sure all variable names match. this works when run as:

echo $employee, "<br>\n";
echo $passwd, "<br>\n";
echo $punchin, "<br>\n";
echo $punchout, "<br>\n";
echo $task, "<br>\n";
echo $task_other, "<br>\n";

eg, not from a function. if it helps any, $employee and $task are drop-down boxes, $passwd is a password field, $punchin and $punchout are radio buttons, and $task_other is plain text field. does it seem weird to anyone else that the Form Interperter portion of php/fi doesnt support functions?

php is compiled with mysql as an apache module, with apache being compiled with mod_speling and mod_mime_magic. the form in question can be glimpsed at on cblood.tiac.net. (forgive speed, its a static ip but a 28.8 line.)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-12-27 00:55 UTC] sas
The variables aren't accessible by a function without declaring them global. See http://ca.php.net/manual/html/variable-scope.html for more info about that.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 12 19:01:30 2024 UTC