标签:
这个前天就该整理鉴于医院吊水而且医院的WiFi只给医生用,直接无语……
<!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=utf-8" /> <title>无标题文档</title> </head> <body> <h1>汽车查询页面</h1> <?php include("./DBDA.class.php"); $db = new DBDA(); $cx=""; $value=""; $value1=""; $tj1=" 1=1";//条件1的判断 $tj2=" 1=1";// if(!empty($_POST["name"])) { $tj1=" Name like ‘%{$_POST[‘name‘]}%‘"; $name=$_POST["name"]; $value=$name; } if(!empty($_POST["brand"])) { $tj2=" brand=‘{$_POST[‘brand‘]}‘"; $name=$_POST["brand"]; $value1=$name; } $cx=" where {$tj1} and {$tj2}"; ?> <form action="test.php" method="post"> <div> 请输入名称:<input type="text" name="name" value="<?php echo $value;?>"/> 系列:<input type="text" name="brand" value="<?php echo $value1 ?>" /> <input type="submit" value="查询" /> </div> </form > <br /> <table width="100%" border="1" cellpadding="0" cellspacing="0"> <tr> <td>代号</td> <td>汽车名称</td> <td>价格</td> <td>油耗</td> <td>功率</td> </tr> <?php $sql = "select * from Car".$cx; $attr = $db->Query($sql); foreach($attr as $v) { //处理Name $rp = "<mark>{$value}</mark>"; $str = str_replace($value,$rp,$v[1]); echo "<tr> <td>{$v[0]}</td> <td>{$str}</td> <td>{$v[7]}</td> <td>{$v[4]}</td> <td>{$v[5]}</td> </tr>"; } ?> </table> </body> </html>
标签:
原文地址:http://www.cnblogs.com/nannan-0305/p/5470625.html