0

私はクラスのサイトに取り組んでおり、フォームシステムを持っています。私の友人がデザインに取り組んでいるので、実際のインデックス サイトは次のとおりです。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Nail n' Bolts man</title>
<link href="../../styles/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="../../js/main.js"></script>
</head>

<body>

    <div id="main">
        <center>
            <div id="header">
                Nails & Bolts APS - Admin side
                <img src="../images/header.jpg" alt="header" width="" height="" />
            </div>

            <?php require('php/newEmployee.php'); ?>
        </center>
    </div>

</body>
</html>

次に、newEmployee.php には varibleEcho.php という別のファイルも必要です

しかし、何らかの理由で、Google Chrome でサイトのソースを確認すると、エコーによって、エコーしたもの以外のすべてがクリーンアップされているようです。これは、私のメタデータ css jquery とそのような dissapers を意味します。

なぜこの動作をするのかについてのアイデアはありますか?

編集:

これがサイト全体です(indes.phpがそこにあります):

newEmployee.php

<?php
require('php/variableEcho.php');
    if(!isset($_POST['rank']) || !isset($_POST['fname']) || !isset($_POST['lname']) || !isset($_POST['initials']))
    {
        variableEcho(0);
        variableEcho(1);    
    }
    else if($_POST['rank'] == '' || $_POST['fname'] == '' || $_POST['lname'] == '' || $_POST['initials'] == '')
    {
        variableEcho(0);
        variableEcho(3);
        variableEcho(1);
    }
        else if($_POST['password'] != '')
    {
    echo $_POST['password'];
    $hasLetter = false;
    $hasNumber = false;
    $hasLength = false;

    $pwd = $_POST['password'];

    $strlen = strlen($pwd);
    $pwdarr = str_split($pwd);

    $ints = 0;
    $chars = 0;
    foreach($pwdarr as $x)
    {
        if(is_int($x))
        {
            $ints++;
        }
        if(ctype_alpha($x))
        {
            $chars++;
        }
    }
    if($ints >= $strlen || $chars >= $strlen)
    {
        variableEcho(0);
        variableEcho(4);
        variableEcho(1);
    }

    if($strlen >= 8)
    {
        variableEcho(0);
        variableEcho(4);
        variableEcho(1);
    }
}
?>

可変エコー

<?php
function variableEcho($echoSelect)
{
    switch($echoSelect)
    {
        case 0:
            echo('
                <form action="" method="post">
                    <table>
            ');
            break;

        case 1:
            echo('
                        <tr>
                            <td><label for="fname">First name*</label></td>
                            <td><input type="text" name="fname" id="fname"/></td>
                        </tr>
                        <tr>
                            <td><label for="lname">Last name*</label></td>
                            <td><input type="text" name="lname" id="lname"/></td>
                        </tr>
                        <tr>
                            <td><label for="rank">Rank*</label></td>
                            <td><input type="text" name="rank" id="rank"/></td>
                        </tr>
                        <tr>
                            <td><label for="initials">Initials (3 length)*</label></td>
                            <td><input type="text" name="initials" id="initials"/></td>
                        </tr>
                        <tr>
                            <td><label for="password">Password</label></td>
                            <td><input type="text" name="password" id="password"/></td>
                        </tr>
                        <tr>
                        <td><input type="submit"/></td>
                    </form>
            ');
            break;

        case 2:
            echo('
                        <tr>
                            <td><div class="errText">A password is required for admins.</div></td>
                            <td></td>
                        </tr>
            ');
            break;

        case 3:
            echo('
                        <tr>
                            <td><div class="errText">Please fill out all the obligatory fields.</div></td>
                            <td></td>
                        </tr>
            ');

        case 4:
            echo('
                        <tr>
                            <td><div class="errText">The password need to be of atleas one letter, one number, and 8 long.</div></td>
                            <td></td>
                        </tr>

            ');
            break;

        default:
            echo('
                biscuit
            ');
            break;
    }
}

?>
4

1 に答える 1

0

私は自分の問題を理解しました、そしてそれは悲しいことに単純なものでした:P

'newEmployee.php' が必要です。

そのphpファイルが含まれます。そのファイルには、ファイルパスがnewEmployee.phpの場所に関連する別のファイルが必要でした。代わりに、代わりにメイン ファイルから variableEcho と newEmployee の両方を含めます。

<?php
    require('../../php/variableEcho.php');
    require('../../php/newEmployee.php');               
?>  
于 2012-12-01T03:43:04.450 に答える