ID: 14811
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: Scripting Engine problem
Operating System: Windows 2000
PHP Version: 4.0.6
New Comment:

After some debugging this appears to be related to arrays. I changed the
FormIncludes[] definition on the Form page to FormInclude0,
FormInclude1, FormInclude2, etc. On the action page I looped through
each of the form variables

$i = 0;
while( 1 )
{
$Variable = "FormInclude" . $i;
...use $$Variable...
}

This works.


Previous Comments:
------------------------------------------------------------------------

[2002-01-02 19:36:46] [EMAIL PROTECTED]

Under certain conditions form variables are not defined. When I access a
form variable by printing it out using print or print_r(
get_defined_vars() ), the form variable is available and has the correct
value as expected. However, when I do not print the variable and use the
form variable in a foreach construct the variable is not defined. 

* register_globals is On according to phpinfo();

* I'm using session variables

* I'm using ob_start() to discard unwanted output.

* I did a standard/default installation.

I've tried simplifying the scripts to narrow down where or what is
causing the problem but all my simplier scripts work fine. The following
are excerpts from the original longer and more complex scripts.

// The Form page
// FileNameX strings were simplied from
"c:\inetpub\wwwroot\ProjectName\Project.php"

<form action='Action.php' method='get'>
<input type='hidden' name='FormIncludes[]' value='FileName1'>
<input type='hidden' name='FormIncludes[]' value='FileName2'>
<input type='hidden' name='FormIncludes[]' value='FileName3'>
<input type='hidden' name='FormIncludes[]' value='FileName4'>
<table cols=2 width='400'>
.... HTML code omitted...
</table>
</form>


// Action.php 

<?php
// These 2 lines have been inserted into the script for debug purposes.

// If left in as-is the variables are defined and print OK, if I comment
out these 2 lines parser complains
// at the foreach loop that $FormIncludes is undefined.

        print_r( get_defined_vars() );
        print( $FormIncludes );
        
        ob_start();
                
        foreach( $FormIncludes as $FileName )
        {
                include_once( $FileName );
        }
                
        session_start();
        
        global $Form;
        
        $Form->PageProcess( $Submit );
?>


------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=14811&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to