马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
<html>
<head>
<title>在线词典</title>
<meta http-equiv = "content-type" content = "text/html; charset = utf-8"/>
<link rel = "stylesheet" type = "text/css" href = "homework1.css"/>
</head>
<div class = "div1">
<ul class = "faceul">
<li> <img src = "12.jpg"/></li>
</ul>
</div>
<h1>查询英文</h1>
<form action = "work.php" method = "post">
请输入英文:<input type= "text" name = "enword"/ >
<input type = "hidden" value = "search1" name = "type"/>
<input type = "submit" value = "查询"/>
<h1>查询中文</h1>
<form action = "work.php" method = "post">
请输入中文:<input type= "text" name = "chword"/ >
<input type = "hidden" value = "search2" name = "type"/>
<input type = "submit" value = "查询"/>
</form>
</html>
<?php
//shou danci \<div class="blockcode"><blockquote>.div1
{
width :300px;
height:300px;
border:1px solid red;
}
.faceul img{
width : 200px;
}
.faceul{
background :pink;
}
.faceul li{
list-style-type:none;
}
require_once 'SqlTool.class.php';
if (isset($_POST['type']))
{
$type = $_POST['type'];
}
else
{
echo "输入为空";
echo "<a href = 'mainview.php'>返回重新查询</a>";
}
if ($type == "search1")
{
if (isset ( $_POST['enword']))
{
$en_word = $_POST['enword'];
}
else
{
echo "输入为空 ";
echo "<a href = 'mainview.php' > 返回重新查询 </a>";
}
$sql = "select chword from words where enword = '".$en_word."' limit 0,1";
//kanshujukuk zhong you mei you zhe tiao ji lu
//设计表
$sqltool = new SqlTool();
$res = $sqltool -> exeute_dql($sql);
if ($row == mysql_fetch_assoc($res))
{
echo $en_word."对应的中文意思是--".$row['chword'];
}
else
{
echo "没有词条";
echo "<br/><a href = 'mainveiw.php'> 返回重新查询</a>";
}
mysql_free_result($res);
}
else if ($type == "search2")
{
if (isset ( $_POST['chword']))
{
$ch_word = $_POST['chword'];
}
else
{
echo "输入为空 ";
echo "<a href = 'mainview.php' > 返回重新查询 </a>";
}
$sql = "select enword from words where chword = '".$ch_word."' limit 0,1";
//kanshujukuk zhong you mei you zhe tiao ji lu
//设计表
$sqltool = new SqlTool();
$res = $sqltool -> exeute_dql($sql);
if ($row == mysql_fetch_assoc($res))
{
echo $ch_word."对应的英文意思是--".$row['enword'];
}
else
{
echo "没有词条";
echo "<br/><a href = 'mainveiw.php'> 返回重新查询</a>";
}
mysql_free_result($res);
}
?>
|