语法错误,意外的T_ELSE

时间:2012-10-12 10:04:27

标签: php

你能看到我出现意外T_ELSE错误的原因吗?我必须是瞎子..

<?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 个答案:

答案 0 :(得分:3)

你有一个;在if之后。只需删除它就可以了......;)

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

答案 1 :(得分:1)

请从

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

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

您在if循环结束时输入了半冒号。请删除它。

答案 2 :(得分:1)

您必须删除第6行的;,如下所示

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

答案 3 :(得分:0)

你的if

末尾有一个半冒号
if($_POST['paypalemail'] != ''); <---