View Single Post

  #4 (permalink)  
Old 10-27-2003
Chris Shiflett
 
Posts: n/a
Default Re: [PHP] RE: function help redirect help

--- Frank Tudor <frank_tudor@yahoo.com> wrote:
> function payment()
> {
> global $payment;
> if ($payment == '0');
> header ('Location: http://ftudor/test/test_page.html');
> }
>
> elseif ($payment == '1')
> {
> header ('Location: http://ftudor/test/test_page2.html');
> }


Your code looks cleaner, so now isn't the error very obvious?

It seems to me that you intended your first conditional statement to send the
Location header when true. Therefore, you did not mean to put a semicolon there
but rather a curly brace.

This is why your function ends prematurely (assuming you did not intend for it
to end there), and then you have an elseif statement dangling around with no
corresponding if.

Chris

=====
My Blog
http://shiflett.org/
HTTP Developer's Handbook
http://httphandbook.org/
RAMP Training Courses
http://www.nyphp.org/ramp
Reply With Quote