0

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>";
        }
} 
?>
KriiV
  • 1,882
  • 4
  • 25
  • 43

4 Answers4

3

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

if($_POST['paypalemail'] != ''); //<-- Remove this ;
Sagito
  • 1,036
  • 1
  • 12
  • 31
1

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.

Siva
  • 44
  • 5
1

You have to delete the ; on line 6 like below

if($_POST['paypalemail'] != '')
    {
        //An email was submitted.
    } 
Sebass van Boxel
  • 2,514
  • 1
  • 22
  • 37
0

You have a semi colon at the end of your if

if($_POST['paypalemail'] != ''); <---
BugFinder
  • 17,474
  • 4
  • 36
  • 51