
May 16th, 2000, 05:12 AM
|
|
Junior Member
|
|
Join Date: May 2000
Posts: 10
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
I am having a problem trying to code a while statement into my PHP script.
I am using PHP-3.0.16.
I have created a PHP script to process up to 15 parameters to extract data from a LDAP database input via a HTML form.
I have the following code :-
<?php function process_form()
{
global $name
global $(the other 14 parameters)
}
?>
<?php
while (list($key,$value = each (HTTP_POST_Vars))
{
if {!empty($value))
if ((value)!=submit)
if ((value)!=results)
$PARAM=$PARAM.$key."=".$value;
}
.
.
.
<?php
if (empty($stage)){display_form();}
else {process_form();}
?>
$PARAM is processed using ldap_search.
If the script is as above, I get details from the LDAP database, but my blank form displays the warning
Variable passed to each() is not an array or object in /www/htdocs/php/seznam2.php3 on line 119. (line 119 is the while command).
If I include the while statement within the process_form function, my blank form is what I want to see ( ie without the warning), but
when I process the form I do not get anything back from the LDAP database and have the warning printed.
I have tried putting the while statement in its own function statement with the same result. The problem is that the HTTP_POST_VARS are not passed to the while statement.
Can anyone please let me know how to overcome this problem.
|