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:[EMAIL PROTECTED]]
> Sent: Tuesday, 15 October 2002 8:06 AM
> To: Anup
> Cc: [EMAIL PROTECTED]
> 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" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >> 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
> >
>


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

Reply via email to