<?php
require_once "config.php";
if($_GET[id]){
$sql_1=mysql_query("select * from $tbname_jihua where name ={$_GET['id']} by id");
}else{
$sql=mysql_query("select * from $tbname_jihua");
}
?><title百家姓查询</title><?php
if($sql){
while($row=mysql_fetch_array($sql)){
echo "<div class=tab_1 style='font-size:20px;'><a href=$row[id].html>".str_replace("氏","",$row[name])."</a></div>";
}
}elseif($sql_1){
$row=mysql_fetch_object($sql_1);
$content=array(id=>$_GET[id],ip=>$ip,time=>time(),val=>$row->name);
$text_class->add_line($content);
echo "<div style='font-size:20px;text-align:center;'>";
echo $row->val;
echo "</table></table>";
echo "</div>";
}
?>一个文本框。 一个提交按钮。还有一个与数据库连接的代码