0

送信前に検証するフォームを作成しようとしています。私のphpコードは次のとおりです。

<?php
    //include the connection file

    require_once('connection.php');
    require_once("validation.php");

    if( isset($_POST['send']) && (!validateName($_POST['name']) || !validateEmail($_POST['email']) || !validatePasswords($_POST['pass1'], $_POST['pass2']) || !validateContact($_POST['contact']) || !validateAge($_POST['age']) || !validateGender($_POST['gender']) || !validateLocation($_POST['location']) || !validateSkill($_POST['skill']) || !validateWork($_POST['work'])) ):?>
                    <ul>
                        <?php if(!validateName($_POST['name'])):?>
                            <li><strong>Invalid Name:</strong> We want names with more than 3 letters.</li>
                        <?php endif?>
                        <?php if(!validateEmail($_POST['email'])):?>
                            <li><strong>Invalid E-mail:</strong> Type a valid e-mail please.</li>
                        <?php endif?>
                        <?php if(!validatePasswords($_POST['pass1'], $_POST['pass2'])):?>
                            <li><strong>Passwords are invalid:</strong> Passwords doesnt match or are invalid!</li>
                        <?php endif?>
                        <?php if(!validateContact($_POST['contact'])):?>
                            <li><strong>Please enter your contact number.</strong></li>
                        <?php endif?>
                        <?php if(!validateAge($_POST['age'])):?>
                            <li><strong>Please enter your contact number.</strong></li>
                        <?php endif?>
                        <?php if(!validateGender($_POST['gender'])):?>
                            <li><strong>Please enter your contact number.</strong></li>
                        <?php endif?>
                        <?php if(!validateLocation($_POST['location'])):?>
                            <li><strong>Please enter your contact number.</strong></li>
                        <?php endif?>
                        <?php if(!validateSkill($_POST['skill'])):?>
                            <li><strong>Please enter your contact number.</strong></li>
                        <?php endif?>
                        <?php if(!validateWork($_POST['work'])):?>
                            <li><strong>Please enter your contact number.</strong></li>
                        <?php endif?>
                    </ul>
                </div>
            <?php elseif(isset($_POST['send'])):?>
                <div id="error" class="valid">
                    <ul>
                    <?php $query = "INSERT INTO employer (name, password, email, contact, age, gender, location, skill, work) VALUES ";                           
                    $query .= "('$name', 'md5($password)', '$email','$contact','$age','$gender','$location','$skill','$work')";
                    // run the query
                    mysql_query($query);?>
                        <li><strong>Congratulations!</strong> All fields are OK ;)</li>
                    </ul>
                </div>
        <?php endif?>

しかし、エラーが表示されます: Fatal error: Call to undefined function validateName() in /home/sifeiitd/public_html/login1.php on line 7

4

1 に答える 1

0

エラーは一目瞭然です。現在のコンテキストに存在しない関数を呼び出そうとしています。インクルードの 1 つにこの機能があることを確認しますか?

于 2012-05-31T20:22:48.803 に答える