Hi Jim,

  Glad that it makes sense now.  In fact, the other page may not even need to exist.  
Instead of including a seperate page, you could simply display the output from within 
this same form script.  I find this extremely useful in combination with a templating 
system.

Happy coding,
  John

>John,
>
>I never even thought of just including the page I was wanting to
>redirect/switch to. I was always ending my processing portion with a
>header("Location : ....") thingy in all of my scripts. As no output comes
>out during the processing stage it should all work.
>
>It seems so straight forward now, thank you.
>
>Jim.....
>
>> Hi Jim,
>>
>>   The header() function call you use below IS doing a GET.  Maybe if you
>told us why you need to redirect to this new page might help.  Simply doing
>the processing then including the new page should work fine, as long as the
>processing part doesn't do any output.  A simple example:
>>
>> if ($REQUEST_METHOD == 'POST') {
>>   if (!isset($name))
>>     echo "Please enter your name!";  // content here or
>>   else
>>     require 'http://www.somehost.com/somescript.php'; // $name & $age set
>>   }
>>
>> John
>>
>> >Thanks for your reply John.
>> >
>> >In fact I'm using the method you describe where the same script is used
>to
>> >both display and process the form.
>> >
>> >However, in the area where I'm doing the processing, I want to redirect
>at
>> >the end of it and still be able to use some of the variables in the
>location
>> >I'm going to go to. Now I know I can just whack them on the end of the
>> >location header:
>> >
>> >    header("Location:
>> >http://www.somehost.com/somescript.php?name=fred&age=5";);
>> >
>> >But I don't want to use this method, I'd rather something similar to GET.
>> >
>> >BTW I'm using PHP4+
>> >
>> >Jim.....
>> >
>> >> 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     [EMAIL PROTECTED]
 */

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

Reply via email to