Re: Using 'Location' and variables

From: Date: Thu, 21 Feb 2002 00:36:17 +0000
Subject: Re: Using 'Location' and variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-85642@lists.php.net to get a copy of this message
Hi Jim, There are several ways to accomplish this such as flat files, database records, sessions, and the like. But I prefer to simply include a file (or have the one file do both form display and processing) and then you get all your variables: if ($REQUEST_METHOD == 'POST') { // either do you processing and diplay here, or include './destination.php'; // with access to all posted vars } else { // display your form } Remember that header() requires a FULLY QUALIFIED DOMAIN NAME and path: header("Location: http://www.somehost.com/somescript.php"); and that it is a GET ($REQUEST_METHOD == 'GET'). The fact that some web servers will display the page anyway is no reason to depend on that. For PHP4+ of course you can use $_SERVER['REQUEST_METHOD'] instead. HTH, John >I'm sure that this is possible, but I haven't found any info/examples on it >yet,.. > >What I have is a php script that processes data that been submitted by a >FORM. > >That's OK,... > >At the end of my script, depending upon the processing, I want to GOTO >another php script, that's also OK, I can simply use the function > > header("Location:destination.php"); > >However, I have a whole lot of variables that were initially submitted, and >I want to take some of them with me when I go to the new destination.php. > >Now, I know I can just tack them on the end like a POST, but I'd prefer to >NOT get them there in the URL, like a GET does,... any ideas ?? > >Thanks in advance, > >Jim..... -- /* SteeleSoft Consulting John Steele - Systems Analyst/Programmer * We also walk dogs... Dynamic Web Design PHP/MySQL/Linux/Hosting * www.steelesoftconsulting.com jsteele@steelesoftconsulting.com */

« previous php.general (#85642) next »