Re: redirecting with variables *depending* on a variable
| From: | Tom Rogers | Date: | Thu, 01 May 2003 00:10:54 +0000 |
| Subject: | Re: redirecting with variables *depending* on a variable | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145872@lists.php.net to get a copy of this message | ||
Hi,
Thursday, May 1, 2003, 6:11:10 AM, you wrote:
RA> Hi,
RA> can this be done:
RA> I will be getting a string of values and variables
RA> ($name,$product_id,$country,$state,$zip etc etc) from a POST method from
RA> address http://blahblah.com/somecgi.cgi .
RA> Is there any way I can do this:
RA> if($product_id=1)
RA> {send to php script that handles id 1 (script1.php)}
RA> else if($product_id=2)
RA> {send to php script that handles id 2 (script2.php)}
RA> ....etc
RA> the part which i am worried about is it has to send it to the new script
RA> (script1.php or script2 .php) WITH all the variables mentioned on top.
RA> If you have any ideas on how this can be done please tell me, with your idea
RA> of doing this would appreciate some code example/s to explain as am a bit of
RA> a newbie myself. if giving me a code example is too much of a pain just
RA> point me to where i can read up on it for the next few hours :-D
RA> Thanks in advance.
RA> Cheers,
RA> -Ryan
You could use includes, that way you have all the variables available
if($product_id=1){
include('script1.php');
}else if($product_id=2){
include('script2.php');
}
....etc
--
regards,
Tom