Forum Moderators: coopster

Message Too Old, No Replies

include function

         

yllai

3:48 am on Jul 19, 2004 (gmt 0)

10+ Year Member



in my main page(main.php), i have using include function to include script in other page(second.php)..means i coded as include('second.php');

the main.php is the interface of the page...second.php is the processing script for process the data..so how do it pass the value from main.php to second.php? any idea? any example of this?

Thanks.

Galaphile

4:39 am on Jul 19, 2004 (gmt 0)

10+ Year Member



What you could do is put the functions in main.php. Then you can check if, let's say a button was pushed, and call the function. You could do it like this:

if(isset($_POST['senddata']))
{
$variable = $_POST['textboxdata'];
$othervariable = $_POST['othertextbox'];
myfunction($variable, $othervariable);
}

yllai

5:09 am on Jul 19, 2004 (gmt 0)

10+ Year Member



how about if i didn't use button?

coopster

12:17 pm on Jul 19, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You can access and use global variables within a function using the global keyword. You'll want to read more about Variable scope [php.net] in PHP.