Help with unexpected elseif

0 Jeremy Benson · March 26, 2015
Hey,

I'm getting an unexpected elseif error on my script. Not sure why..



// handle Stripe exceptions
        // go to form with Exception
        
        if(isset($errors['Stripe_CardError']))
        {
        
           echo 'Please wait...';
           echo '';
        
        }elseif(isset($errors['Stripe_InvalidRequest']))
        
           echo 'Please wait...';
           echo '';
          
        }elseif(isset($errors['Stripe_AuthenticationError']))
        {
        
           echo 'Please wait...';
           echo '';

        }elseif(isset($errors['Stripe_ApiConnectionError']))
        {

           echo 'Please wait...';
           echo '';

        }elseif(isset($errors['Stripe_Error']))
        {
 
           echo 'Please wait...';
           echo '';
   
        }else(isset($errors['Exception']))
        {

           echo 'Please wait...';
           echo '';
        
        }

    }


The elseif in question seems to be


elseif(isset($errors['Stripe_AuthenticationError']))
        {
        
           echo 'Please wait...';
           echo '';



hmm, pretend The New Boston links aren't there. Seems to be a bug on the forum adding them in.



Post a Reply

Replies

Oldest  Newest  Rating
0 T P · March 27, 2015
Hi,Jeremy
1. You missed closing parenthesis of if  ')'  statement everywhere. 
2. You missed the opening brace '{' in first else if.
3. else construct does not take any arguments.

1. You missed closing parenthesis of if  ')'  statement everywhere. Change this line of code, make changes everywhere :
if(isset($errors['Stripe_CardError'])


to this :
if(isset($errors['Stripe_CardError']))


2.You missed the opening brace '{' in first else if. Change this line :
elseif(isset($errors['Stripe_InvalidRequest']))
       
           echo 'Please wait...';
           echo '';
          
        }

to this :
elseif(isset($errors['Stripe_InvalidRequest']))
        {
           echo 'Please wait...';
           echo '';
          
        }

3. the else statement : 
else(isset($errors['Exception'])
{

echo 'Please wait...';
echo '';

}


should be like this :
else
{

echo 'Please wait...';
echo '';

}

or like this :

elseif(isset($errors['Exception']))
{
echo 'Please wait...';
echo '';
}
0 Mohamad Mirohamadi · March 28, 2015
You should not use semicolon in the if condition

replace:
elseif(isset($errors['Exception']; ))

with:

elseif(isset($errors['Exception']))
  • 1

PHP

107,173 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators