我正在一个网站上上课,我有一个表单系统。我的朋友正在设计,因此索引站点实际上是这样的:
<!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 的文件 基本上这个文件只有一个带有 switch case 语句的函数,根据你从 newEmployee.php 调用的内容来回显不同的代码
但是由于某种原因,当我使用谷歌浏览器检查网站的来源时,似乎回显清除了除了我回显的内容之外的所有内容。这意味着我的元数据 css jquery 和这样的分散器。
关于它为什么有这种行为的任何想法?
编辑:
这是整个网站(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;
}
}
?>