Php 提交表单后,我的页脚更改位置
我一直有一个非常讨厌的“错误”。。。 我的页面有页眉、左侧边栏和页脚。我提交表单后,一切都很好,除了现在页脚在页面的中间!!我尝试了所有我知道的方法,但我仍然无法解决这个问题 提交前,页脚在正确的位置:Php 提交表单后,我的页脚更改位置,php,html,mysql,css,Php,Html,Mysql,Css,我一直有一个非常讨厌的“错误”。。。 我的页面有页眉、左侧边栏和页脚。我提交表单后,一切都很好,除了现在页脚在页面的中间!!我尝试了所有我知道的方法,但我仍然无法解决这个问题 提交前,页脚在正确的位置: 提交后,页脚位于页面中间: 代码如下: 标题: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="stylesh
提交后,页脚位于页面中间: 代码如下: 标题:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="stylesheets/stylesheet.css" type="text/css" rel="stylesheet" />
<title>Wilson Electric & Alarm Company</title>
</head>
<body>
<div id="header">
<h1 id="toptitle"> Wilson Electric & Alarm Company </h1>
</div>
<div id="navigation_top">
</div>
<div id="column_left">
<ul id="left_menu">
<li> <a href="testing2.php"> Insert Page </a> </li>
<li> <a href="search.php"> Search Page </a> </li>
<li> <a href=""> Menu 4 </a> </li>
<li> <a href=""> Menu 5 </a> </li>
<li> <a href=""> Menu 6 </a> </li>
<li> <a href="user.php"> User </a> </li>
<li> <a href="admin.php"> Admin </a> </li>
<li> <a href="login.php"> Login </a> </li>
<li> <a href="create_username.php"> Create Username </a> </li>
</ul>
</div>
<div id="content">
这是给我这些问题的页面代码
<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php
if (isset($_POST['search'])) {
$date1 = mysql_prep($_POST['date1']);
$date2 = mysql_prep($_POST['date2']);
$latte = mysql_prep($_POST['latte']);
$coffee = mysql_prep($_POST['paid']);
$query = "SELECT *
FROM payroll
WHERE (day BETWEEN '{$date1}' AND '{$date2}')
AND (company = '{$latte}')
AND (paid = '{$coffee}')
ORDER BY day ASC ";
$result = mysql_query($query, $connection);
$woof = "SELECT SUM(p.hours) AS sum_hours
, COUNT(DISTINCT p.day) AS cnt_days
FROM PAYROLL p
WHERE p.day BETWEEN '{$date1}' AND '{$date2}'
AND company = '{$latte}'
AND paid = '{$coffee}' ";
$raw = mysql_query($woof, $connection);
if(!$raw) { die(mysql_error());}
$meow = mysql_result($raw, 0, 0);
$days = mysql_result($raw, 0, 1);
if(!$result) {
echo "FAIL";
} else {
$message = "<table>
<tr>
<th> Date </th>
<th> Hours </th>
<th> Job Title </th>
<th> Job Description </th>
<th> For </th>
<th> Paid </th>
</tr>";
while($row = mysql_fetch_array($result)) {
$company = $row['company'];
if($company == 0) {
$company = "Wilson Electric";
} if($company == 1) {
$company = "Wilson Rental";
} if ($company == 2) {
$company = "Church of Christ";
}
$paid = $row['paid'];
if($paid == 0) {
$paid = "Yes";
} else {
$paid = "<form action=\"update.php\" method=\"post\" ><input type=\"checkbox\" name=\"paid\" value=\"0\"> NO ";
}
$message .= "<tr>";
$message .= "<td class=\"center\">" . $row['day'] . "</td>";
$message .= "<td class=\"center\">" . $row['hours'] . "</td>";
$message .= "<td style=\"padding:5px;\">" . $row['job_title'] . "</td>";
$message .= "<td style=\"padding:5px;\">" . $row['job_description'] . "</td>";
$message .= "<td style=\"padding:5px;\">" . $company . "</td>";
$message .= "<td class=\"center\">" . $paid . "</td>";
$message .= "</tr>";
}
$message .= "<tr>";
$message .= "<td class=\"center\"> Total Days: " . $days . "</td>";
$message .= "<td class=\"center\"> Total Hours: " . $meow . "</td>";
$message .= "<td class=\"center\"> </td>";
$message .= "<td class=\"center\"> </td>";
$message .= "<td class=\"center\"> </td>";
$message .= "<td class=\"center\"> <input type=\"submit\" name=\"gamind\" value=\"Update\"> </form> </td>";
$message .= "</tr>";
}
}
?>
<?php include("includes/header.php"); ?>
<form action="" method="post" id="form">
<h1 class="formtitle"> Search </h1>
<br />
<table id="table1">
<th> From </th>
<th> To </th>
<th> For </th>
<th> Paid </th>
<tr>
<td>
<input type="date" name="date1" value="" >
</td>
<td>
<input type="date" name="date2" value="" >
</td>
<td>
<select name="latte" >
<option value="0"> Wilson Electric </option>
<option value="1"> Wilson Rental </option>
<option value="2"> Church of Christ</option>
</select>
</td>
<td>
<input type="radio" name="paid" value="0"> Yes <br />
<input type="radio" name="paid" value="1"> No <br />
</tr>
<tr>
<td colspan="4" align="right"> <input type="submit" name="search" value="Search">
</td>
</tr>
</table>
<br />
<br />
<p>
<?php
if(!empty($message)) {
echo "<h1 class=\"formtitle\"> Payroll Result </h1>";
echo $message;
}
?>
</p>
</form>
<?php include("includes/footer.php"); ?>
<?php mysql_close($connection); ?>
这里有很多代码需要接受,但我认为,您的$message生成了s,但是当您回显$message时,您不在表元素中。呈现的标记是否有效?@Waleed Khan:您能解释一下这是什么意思吗?Prob意味着W3C html验证程序:检查生成的html代码的一种方法是有效的,根据W3C的规则,$message已经在一个表中了,它是一个长字符串,我用它来构建。=来把所有东西放在一起。$message上的第一件事是表构建良好。。只是页脚出了问题。哦,是的-刚刚看到。。。看不见那个人吗?天哪!真不敢相信我这么愚蠢:(为龙的帖子道歉!!!非常感谢你的帮助!!刚刚添加了,一切都很好!!!
#container {
width:100%;
height:100%;
}
#header {
width: 100%;
height:120px;
}
#column_left {
float:left;
width:15%;
height:100%;
border-right: 3px solid #06F;
border-left: 3px solid #06F;
}
#content {
width:100%;
height:100%;
}
#footer {
width:100%;
height: 30px;
border-top:3px solid #06F;
}
#navigation_top {
width:100%;
height:15px;
border-bottom:3PX solid #06F;
}
#toptitle {
padding:30px;
font-size:300%;
font-weight:700;
}
.formtitle {
font-weight:800;
font-size:150%;
}
#form {
margin-left:230px;
padding-top:30px;
}
table,th, td {
border: 1px solid black;
}
table {
width:1024px;
}
th {
font-weight:800;
background-color:#0FF;
}
<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php
if (isset($_POST['search'])) {
$date1 = mysql_prep($_POST['date1']);
$date2 = mysql_prep($_POST['date2']);
$latte = mysql_prep($_POST['latte']);
$coffee = mysql_prep($_POST['paid']);
$query = "SELECT *
FROM payroll
WHERE (day BETWEEN '{$date1}' AND '{$date2}')
AND (company = '{$latte}')
AND (paid = '{$coffee}')
ORDER BY day ASC ";
$result = mysql_query($query, $connection);
$woof = "SELECT SUM(p.hours) AS sum_hours
, COUNT(DISTINCT p.day) AS cnt_days
FROM PAYROLL p
WHERE p.day BETWEEN '{$date1}' AND '{$date2}'
AND company = '{$latte}'
AND paid = '{$coffee}' ";
$raw = mysql_query($woof, $connection);
if(!$raw) { die(mysql_error());}
$meow = mysql_result($raw, 0, 0);
$days = mysql_result($raw, 0, 1);
if(!$result) {
echo "FAIL";
} else {
$message = "<table>
<tr>
<th> Date </th>
<th> Hours </th>
<th> Job Title </th>
<th> Job Description </th>
<th> For </th>
<th> Paid </th>
</tr>";
while($row = mysql_fetch_array($result)) {
$company = $row['company'];
if($company == 0) {
$company = "Wilson Electric";
} if($company == 1) {
$company = "Wilson Rental";
} if ($company == 2) {
$company = "Church of Christ";
}
$paid = $row['paid'];
if($paid == 0) {
$paid = "Yes";
} else {
$paid = "<form action=\"update.php\" method=\"post\" ><input type=\"checkbox\" name=\"paid\" value=\"0\"> NO ";
}
$message .= "<tr>";
$message .= "<td class=\"center\">" . $row['day'] . "</td>";
$message .= "<td class=\"center\">" . $row['hours'] . "</td>";
$message .= "<td style=\"padding:5px;\">" . $row['job_title'] . "</td>";
$message .= "<td style=\"padding:5px;\">" . $row['job_description'] . "</td>";
$message .= "<td style=\"padding:5px;\">" . $company . "</td>";
$message .= "<td class=\"center\">" . $paid . "</td>";
$message .= "</tr>";
}
$message .= "<tr>";
$message .= "<td class=\"center\"> Total Days: " . $days . "</td>";
$message .= "<td class=\"center\"> Total Hours: " . $meow . "</td>";
$message .= "<td class=\"center\"> </td>";
$message .= "<td class=\"center\"> </td>";
$message .= "<td class=\"center\"> </td>";
$message .= "<td class=\"center\"> <input type=\"submit\" name=\"gamind\" value=\"Update\"> </form> </td>";
$message .= "</tr>";
}
}
?>
<?php include("includes/header.php"); ?>
<form action="" method="post" id="form">
<h1 class="formtitle"> Search </h1>
<br />
<table id="table1">
<th> From </th>
<th> To </th>
<th> For </th>
<th> Paid </th>
<tr>
<td>
<input type="date" name="date1" value="" >
</td>
<td>
<input type="date" name="date2" value="" >
</td>
<td>
<select name="latte" >
<option value="0"> Wilson Electric </option>
<option value="1"> Wilson Rental </option>
<option value="2"> Church of Christ</option>
</select>
</td>
<td>
<input type="radio" name="paid" value="0"> Yes <br />
<input type="radio" name="paid" value="1"> No <br />
</tr>
<tr>
<td colspan="4" align="right"> <input type="submit" name="search" value="Search">
</td>
</tr>
</table>
<br />
<br />
<p>
<?php
if(!empty($message)) {
echo "<h1 class=\"formtitle\"> Payroll Result </h1>";
echo $message;
}
?>
</p>
</form>
<?php include("includes/footer.php"); ?>
<?php mysql_close($connection); ?>