我正在为我的学校项目制作电话簿,但这是我迄今为止的工作。我想隐藏表头(姓氏、名字等),然后在得到结果后查看它。
这些图像是在我搜索名称之前和之后,这是我的代码:
<table class="gridtable">
<th>Last Name</th>
<th>First Name</th>
<th>Address</th>
<th>Telephone Number</th>
<th>Network</th>
<th>Something Wrong?</th>
这是我的表头
include 'database.php';
$lname = "";
$fname = "";
if(isset($_POST['lname']) || (isset($_POST['fname']))){ $fname = $_POST['fname']; $lname = $_POST['lname']; }
if(!isset($_POST['fname']) || ($_POST['lname'])) ;
$vars = array('lname');
$verified = TRUE;
foreach($vars as $v) {
if(!isset($_POST[$v]) || empty($_POST[$v])) {
$verified = FALSE;
}
}
if(!$verified) {
exit();
}
$result = mysql_query("SELECT * FROM sheet1 WHERE lname like '%$lname%' AND fname like '%$fname%' ");
这是我回应我的结果的地方
if($count = mysql_num_rows($result)){
echo "<p class=\"count\"> <b>$count </b> Results for <b><i>\" $lname $fname \"</i></b> </p>";
}
else
echo "<p class=\"count\"> No Result for - <b><i>\" $lname $fname \"</i></b></p>";
while(@$row = mysql_fetch_array($result)){
echo
"<tr>" .
"<td><b>" . $row['lname'] . "</b></td>" .
"<td><b>" . $row['fname'] . "</td>" .
"<td>" . $row['address'] . "</td>" .
"<td>" . $row['telnum'] . "</td>" .
"<td>" . $row['network'] . "</td>" .
"<td>" .
"<input type = \"submit\" value= \"Report\" class= \"classname \" name= \"report\">" .
"</tr>";
}
?>