意外的T_IF错误

时间:2012-06-08 06:16:46

标签: php sql

当我收到此错误时,我正在编写一个注册脚本。另外,我想扩展我对这个特定错误的了解。无尽的谷歌搜索==>没有帮助。这是我的代码:

<?php
          //include the connection file

          require_once("functions/validation_employee_signup.php");
          require_once("functions/functions.php")

    if( isset($_POST['send']) && (!validateName($_POST['name']) || !validateEmail($_POST['email']) || !validatePasswords($_POST['pass1'], $_POST['pass2']) || !validateContact($_POST['contact']) || !validateAge($_POST['age'])) ):?>
                <div id="error">    
                    <ul>
                        <? if(!validateName($_POST['name'])):?>
                            <li><strong>Invalid Name:</strong> We want names with more than 3 letters.</li>
                        <? endif?>
                        <? if(!validateEmail($_POST['email'])):?>
                            <li><strong>Invalid E-mail:</strong> Type a valid e-mail please.</li>
                        <? endif?>
                        <? if(!validatePasswords($_POST['pass1'], $_POST['pass2'])):?>
                            <li><strong>Passwords are invalid:</strong> Passwords doesnt match or are invalid!</li>
                        <? endif?>
                        <? if(!validateContact($_POST['contact'])):?>
                            <li><strong>Please enter a valid number.</strong></li>
                        <? endif?>
                        <? if(!validateAge($_POST['age'])):?>
                            <li><strong>Please enter a valid age</strong></li>
                        <? endif?>
                        </ul>
                </div>
            <?php elseif(isset($_POST['send'])):?>
                <div id="error" class="valid">
                    <ul>
                    <?php
                    require_once('functions/connection.php'); 
                    $query = "INSERT INTO employee (name, password, email, contact, age, gender, location, skill, work) VALUES ";                
                    $email = protect($_POST['email']);
                    $res = mysql_query("SELECT * FROM `employee` WHERE `email` = '".$email."'");
                    $num = mysql_num_rows($res);
                    if($num == 1){
                            //if yes the username is taken so display error message
                            echo  "<li><strong>The EMail ID you have chosen is already taken!</strong></li>";
                                }else{           
                                $query .= "('".$_POST['name']."', MD5('".$_POST['pass1']."'), '".$email."','".$_POST['contact']."','".$_POST['age']."','".$_POST['gender']."','".$_POST['location']."','".$_POST['skill']."','".$_POST['work']."')";
                    // run the query
                    mysql_query($query);}?>
                    <li><strong>Congratulations!</strong> You have been successfully registered!</li>
                    </ul>
                </div>
        <?php endif?>

2 个答案:

答案 0 :(得分:1)

显然它不期望if语句,并且你似乎忘记了第5行的分号。

答案 1 :(得分:0)

     require_once("functions/functions.php") ;  // at line 5

如果您使用了IDE,那么您已经错过了这里的半结肠,那么您就已经知道了