RE: [PHP] Re: two submit buttons redirecting to two scripts

From: Date: Tue, 15 Oct 2002 00:44:00 +0000
Subject: RE: [PHP] Re: two submit buttons redirecting to two scripts
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-119971@lists.php.net to get a copy of this message
make sure there is nothing before the if statements for example <?php if ($b1) { redirct to script1 } elseif ($b2) { redirct to script2 } <HTML> etc </HTML> and that should work fine regardless if your using the Header( Location...) other means > -----Original Message----- > From: Sonal Patel [mailto:sonal@antriksh.com] > Sent: Tuesday, 15 October 2002 8:06 AM > To: Anup > Cc: php-general@lists.php.net > Subject: Re: [PHP] Re: two submit buttons redirecting to two scripts > > > sorry, earlier I did not send the message to the group. > > Anup, I tried your solution which works exactly same as mine, > and it also gives me error when I try to redirect. > As far as echoing which button was selected --it was fine and both > scripts work same. > But redirect does not work. > > here is the error message, > Warning: Cannot add header information - headers already sent by > (output started at /home3/www/antriksh/resources/action2.php:5) in > /home3/www/antriksh/resources/action2.php on line 13 > > any help? > > > > On Monday, October 14, 2002, at 05:49 PM, Anup wrote: > > > you have this: > > <input type="submit" value="b1" name="action" /> > > > > <input type="submit" value="b2" name="action" /> > > > > change the name of the buttons to b1 and b2, respectively, and give > > them > > some non-null value (as you have it) > > Then in action.php you will have the following code: > > if ($b1) { > > redirct to script1 > > } > > elseif ($b2) { > > redirct to script2 > > } > > > > /*Either b1 OR b2 will have a value, not both, and use header() to > > redirect > > the sctipt*/ > > > > > > > > > > "Sonal Patel" <sonal@antriksh.com> wrote in message > > news:8DFF5F2C-DFBC-11D6-BC1B-0030655649F6@antriksh.com... > >> Hello, > >> > >> I am very new to this group. > >> > >> I have a very simple question. > >> Please look at this form, > >> > >> http://antriksh.com/resources/2_submit_button_form.shtml > >> > >> here I want to change the echo statement in the script "action.php" to > >> redirect it to another script. > >> > >> ie, I want to change the form action dynamically. How can I modify > >> this form to do so? > >> > >> I tried few PHP tricks that did not work for me. So I am asking this > >> questions to anyone who may be able to help. > >> > >> Thank you , > >> Sonal > >> > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > >

« previous php.general (#119971) next »