[PHP] RE: function help redirect help

2003-10-27 Thread Frank Tudor
$payment = 1;

function payment(){
global $payment;
if ($payment == 0); 
header (location:test_page.html);
}
global $payment;
elseif ($payment == 1) {
header (location:test_page2.html);
}

__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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



[PHP] RE: function help redirect help

2003-10-27 Thread Frank Tudor
Here is what Ihave

I am getting a elseif parse error.  Is there something I'm
leaving out?

Frank

code
---

$payment = 1;

function payment(){
global $payment;
if ($payment == 0); 
header (location:test_page.html);
}
global $payment;
elseif ($payment == 1) {
header (location:test_page2.html);
}

__
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

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



RE: [PHP] RE: function help redirect help

2003-10-27 Thread Gregory Kornblum
Remove the second 'global $payment;'. Regards.

-Gregory

-Original Message-
From: Frank Tudor [mailto:[EMAIL PROTECTED]
Sent: Monday, October 27, 2003 2:01 PM
To: 1PHP
Subject: [PHP] RE: function help redirect help


Here is what Ihave

I am getting a elseif parse error.  Is there something I'm
leaving out?

Frank

code
---

$payment = 1;

function payment(){
global $payment;
if ($payment == 0); 
header (location:test_page.html);
}
global $payment;
elseif ($payment == 1) {
header (location:test_page2.html);
}

__
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

-- 
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



Re: [PHP] RE: function help redirect help

2003-10-27 Thread Chris Shiflett
--- Frank Tudor [EMAIL PROTECTED] wrote:
 I am getting a elseif parse error.

Let me clean up your code a bit, and hopefully the error will stand out.

function payment()
{
 global $payment;
 if ($payment == '0'); 
 header ('Location: http://example.org/test_page.html');
}

global $payment;

elseif ($payment == '1')
{
 header ('Location: http://example.org/test_page2.html');
}

Can you see the problem(s) now? Never underestimate the benefits of writing
clean code. :-)

Chris

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

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



Re: [PHP] RE: function help redirect help

2003-10-27 Thread Frank Tudor
I made the changes but I am getting:

Parse error: parse error, unexpected T_ELSEIF

I did take the second global statement out after I cut and
pasted your code and modified the urls

so now here is what it looks like (the whole thing).

Frank


?PHP
$payment = 1;



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');
}



?

__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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



Re: [PHP] RE: function help redirect help

2003-10-27 Thread Chris Shiflett
--- Frank Tudor [EMAIL PROTECTED] 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

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



Re: [PHP] RE: function help redirect help

2003-10-27 Thread DvDmanDT
 Can you see the problem(s) now? Never underestimate the benefits of
writing
 clean code. :-)

Hehe, you should see my code..

function dp_neg($v1,$v2){
$neg = ((substr((string)$v1,0,1)==-)||((substr((string)$v2,0,1)==-)));
$bneg= ((substr((string)$v1,0,1)==-)((substr((string)$v2,0,1)==-)));
if(!$bneg  $neg){
$tmp=$v1*$v2;
$tmp=(string)$tmp;
$an=str_replace(-,+,$tmp);
}
else{
$an=-.($v1*$v2);
}
return $an;
}
function xyz($f,$s){
$f=s_str($f);
$s=s_str($s);
$t=($f==$s)?$f:s_str($f.$s);
return $t;
}
function s_str($str)
{$l=strlen($str);for($x=0;$x$l;$x++){$ar[]=$str{$x};}sort($ar);return
implode('',$ar);}
$e_a[0]=gs($e1);$e_a[1]=gs($e2);
$e_a[2]=gs($e3);$e_a[3]=gs($e4);
for($i=0;$i4;$i++){
$t[$i]=split(:,$e_a[$i]);}
$r[0][0]=dp_neg($t[0][3],$t[2][3]);
$r[0][1]=xyz($t[0][2],$t[2][2]);
$r[1][0]=dp_neg($t[0][3],$t[3][3]);
$r[1][1]=xyz($t[0][2],$t[3][2]);
$r[2][0]=dp_neg($t[1][3],$t[2][3]);
$r[2][1]=xyz($t[1][2],$t[2][2]);
$r[3][0]=dp_neg($t[1][3],$t[3][3]);
$r[3][1]=xyz($t[1][2],$t[3][2]);
for($i=0;$i4;$i++){
$exp .=
((substr($r[$i][0],0,1)==-)?$r[$i][0].$r[$i][1]:($r[$i][0].$r[$i][1])).
;}


No, that probably wont compile as that's only a little part of it, but still
a pretty easy part of it.. :)
-- 
// DvDmanDT
MSN: dvdmandt¤hotmail.com
Mail: dvdmandt¤telia.com
##
Please, if you are using windows, you may be infected by Swen. Please go
here to find out more:
http://us.mcafee.com/virusInfo/default.asp?id=helpCenterhcName=swen
http://securityresponse.symantec.com/avcenter/venc/data/[EMAIL PROTECTED]
##

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



Re: [PHP] RE: function help redirect help

2003-10-27 Thread Chris Shiflett
--- DvDmanDT [EMAIL PROTECTED] wrote:
  Can you see the problem(s) now? Never underestimate the benefits of
  writing clean code. :-)
 
 Hehe, you should see my code..

Yes, very messy and disorganized. Is this an admission of guilt, a cry for
help, or what?

Chris

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

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