If the code is in a function then don't you need to call
at the top of the function so that it knows you can use that varible?

----- Original Message -----
From: "César Aracena" <[EMAIL PROTECTED]>
To: "PHP General List" <[EMAIL PROTECTED]>
Sent: Sunday, June 23, 2002 11:06 PM
Subject: [PHP] Is this a BUG?

Hi all,

A couple of days ago, I've been starting to organize all my scripts into
functions within libraries, and got into a problem this morning. Now, I
don't know if this is a bug or it's just me getting confused. I got the
problem when calling two functions - one gets variables from the other -
within the same page.

That is, I have a mainusers.php page, which only calls for functions
instead of writing them all together inside that page. At one step, it
calls for an "adduser" function which brings a table that let the
administrator insert a new user. After the submit button is pressed, it
calls for a function called "useradded" which resides in the same
library as the "adduser" function. This useradded function queries the
database, inserting the user. The problem is that it does not get the
HTTP_POST_VARS although they are being passed according to phpinfo.php.

The structure is this:

Project directory

>Library Directory
>>>adduser() function
>>>useradded() function

>Pages directory
>>>first calls for adduser()
>>>and then for useradded()

Now, the thing is if I, instead of calling the function, write the query
directly in the mainusers.php page, the variables are get well and
written into the database. I don't know if this makes much sense, but
the thing is. Isn't PHP forced to pass those variables before the
function is called so when they're needed they can be get through
HTTP_POST_VARS or just $var_name which I like using?


Cesar Aracena <mailto:[EMAIL PROTECTED]>
Neuquen, Argentina

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to