include site setting for php values one 1 page

selvol
selvol used Ask the Experts™
on
I am having some trouble including 1 file containing php values used throughout my site.

I want to just put

 include_once('./includes/preprocess_values.inc');

Open in new window


on top of all pages instead of the complete code.

I have tried using the "include" function a few ways.
But I want to include some $_GET values and the dont seem to be passed.


Here is an example of what I would like to have in the include file

$fname =  ucwords(strtolower($_GET['fname'])) ;
 $lname =  ucwords(strtolower($_GET['lname'])) ;

Open in new window


Any suggestion are appreciated.
Thank you Selvol
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Try adding the function to the preprocess_value.inc like below code and call them with every page where you include the above file

hope that helps, thanks

//preprocess_value.inc

function preprocessvalues($fname,$lname){
     $arr = array();
     $arr['fname'] =  ucwords(strtolower($fname)) ;
      $arr['lname'] =  ucwords(strtolower($lname)) ;
      return $arr;
}

// now try calling the function after including the above file to page with below
// some page.php
 include_once('./includes/preprocess_values.inc');
                                  
$arr = preprocessvalues($_GET['fname'],$_GET['lname']); // process the array 

Open in new window

Author

Commented:
Thank you.
That shortens it some.
and explains why it would not work.

Anyway to set those values like a "global" would work?

i.e. in the php.ini?
Selvol

Author

Commented:
Got it..........

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial