Re: passthru environment variables

From: Date: Sun, 11 Feb 2001 08:55:51 +0000
Subject: Re: passthru environment variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-39113@lists.php.net to get a copy of this message
> I'm trying to use passthru in a PHP program to have an external program > display some data. The problem is that I was trying to have the external > program's environment pick up the form field variables automatically passed > into the PHP program as shell environment variables. > > In other words, if a user typed "Smith" into the last_name field in a form, > the PHP program called by that form starts out with $last_name = "Smith", > and I would like the external program called by passthru within the PHP > program to have a shell environment variable last_name = "Smith". > > Does anyone know an easy way to do this? http://php.net/setenv <?php SetEnv("last_name='$last_name'"); ?> Since you probably want to do this for all your POST vars, check out http://php.net/FAQ.php#7.1 <?php reset($HTTP_POST_VARS); while (list($var, $val) = each($HTTP_POST_VARS)){ SetEnv("$var='$val'"); } ?> -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#39113) next »