0
votes

Can you see any reason why I would be getting an unexpected T_ELSE error? I must be blind..

<?php
//Check if form was submitted
if(isset($_POST['submit']))
{   
    //Form was submitted.
    if($_POST['paypalemail'] != '');
    {
        //An email was submitted.
    } 
    else
        {
            //There was nothing in the field. Tell them.
            echo "<script language=\"javascript\">alert('The field was left empty. Please insert your PayPal email address and try again.');</script>";
        }
} 
?>
4
try removing the ";" on if($_POST['paypalemail'] != ''); - user1732887

4 Answers

3
votes

You have a ; after the if. Just remove it and you will be fine... ;)

if($_POST['paypalemail'] != ''); //<-- Remove this ;
1
votes

Please change the script from

if($_POST['paypalemail'] != '');
{
     //An email was submitted.
}

to

if($_POST['paypalemail'] != '') 
{
    //An email was submitted.
}

You have entered semi colon at the end of if loop. Please remove it.

1
votes

You have to delete the ; on line 6 like below

if($_POST['paypalemail'] != '')
    {
        //An email was submitted.
    } 
0
votes

You have a semi colon at the end of your if

if($_POST['paypalemail'] != ''); <---