我有一个页面,用户在其中搜索 pdf,结果显示在该页面中,但显示在特定的 div 中。显示了表格,但页面的整个设计被破坏了......有人能指出我是什么吗在这里做错了吗?
<div id="content">
<div class="post">
<div class="entry">
<form name="search" action="" method="post">
<input type="text" class="search" name="searchbox" id="searchbox" />
<input type="submit" name="search" id="search" value="Search" />
</form>
</div>
</div>
<div class="post">
<div class="entry">
<?php
if(isset($_REQUEST['search'])){
$searchterm = $_REQUEST['searchbox'];
$sql = "select name,size from ebooks where name like '%$searchterm%'";
$result=mysql_query($sql);
if(!($result)){
die("Query to show fields from table failed");
}
$fields_num = mysql_num_fields($result);
echo "<table border='1'><tr>";
// printing table headers
for($i=0; $i<$fields_num; $i++){
$field = mysql_fetch_field($result);
echo "<td>{$field->name}</td>";
}
echo "</tr>\n";
// printing table rows
while($row = mysql_fetch_row($result)){
echo "<tr>";
// $row is array... foreach( .. ) puts every element
// of $row to $cell variable
foreach($row as $cell)
echo "<td>$cell</td>";
echo "</tr>\n";
}
mysql_free_result($result);
}
?>
</div>
</div>