<!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=gb2312" />
<title>无标题文档</title>
</head><body>
<p><strong>Search center</strong></p>
<table border="1" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td colspan="3"><table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="100%"><div align="center"><br />
<strong>Search center</strong> </div></td>
<td><p align="left"> </p></td>
<td width="10"><p align="left"> </p></td>
</tr>
</table></td>
</tr>
<tr>
<td width="10" height="206"><p align="left"> </p></td>
<td width="100%"><div align="center">
<form id="form1" name="form1" method="post" action="">
<p>
<select name="select">
<option value="c_cas">CAS-No</option>
<option value="c_name">Chemical Name</option>
<option value="c_no">Product Number</option>
<option value="c_fenzishi">Molecular Formula</option>
</select>
</p>
<p>
<input type="text" name="chaxun" />
</p>
<p>
<input name="Submit2" type="submit" value="go" />
</p>
</form>
</div></td>
<td><p align="left"> </p></td>
</tr>
<tr>
<td height="206"> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>代码是这样的 就是要选中下拉框的其中一项为基准,文本框为条件,按按钮查询跳转到a.php显示出这个物品的全部信息怎么写啊?????
2 。 在 a.php 中 接受 2 个form 表单参数 ,
3 。 以这两个参数为条件 查询数据库
4 。 把 查出来的结果 显示出来 就OK 了
<?php require_once('../../../../Connections/mydb.php'); ?>
<?php
mysql_select_db($database_mydb, $mydb);
$query_Recordset1 = "SELECT * FROM chanpinbiao";
$Recordset1 = mysql_query($query_Recordset1, $mydb) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?><!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=gb2312" />
<title>无标题文档</title>
</head><body>
<form id="form1" name="form1" method="post" action="">
<table border="0" cellspacing="1" cellpadding="0" width="95%">
<tr>
<td width="99%" colspan="3"><p align="center"> <?php echo $row_Recordset1['c_name']; ?></p></td>
</tr>
<tr>
<td width="99%" colspan="3"><p align="center"><strong>基本信息</strong> </p></td>
</tr>
<tr>
<td width="29%"><p align="right">英文名 </p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><p align="left"> <?php echo $row_Recordset1['c_enname']; ?></p></td>
</tr>
<tr>
<td width="29%"><p align="right">产品名称 </p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><p align="left"> <?php echo $row_Recordset1['c_name']; ?></p></td>
</tr>
<tr>
<td width="99%" colspan="3"><p align="center"> </p></td>
</tr>
<tr>
<td width="29%"><p align="right">分子结构 </p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><p align="left"> <?php echo $row_Recordset1['c_jiegou']; ?></p></td>
</tr>
<tr>
<td width="99%" colspan="3"><p align="center"> </p></td>
</tr>
<tr>
<td width="29%"><p align="right">分子式 </p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><p align="left"> <?php echo $row_Recordset1['c_fenzishi']; ?></p></td>
</tr>
<tr>
<td width="29%"><p align="right">分子量 </p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><p align="left"> <?php echo $row_Recordset1['c_fenziliang']; ?></p></td>
</tr>
<tr>
<td width="29%"><p align="right">CAS 登录号 </p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><p align="left"> <?php echo $row_Recordset1['c_cas']; ?></p></td>
</tr>
<tr>
<td width="29%"><p align="right">Product Number</p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><p align="left"> <?php echo $row_Recordset1['c_no']; ?></p></td>
</tr>
<tr>
<td width="29%"><p align="right">EINECS 登录号 </p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><p align="left"> <?php echo $row_Recordset1['c_einecs']; ?></p></td>
</tr>
<tr>
<td width="29%"><p align="right">备注信息:</p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><?php echo $row_Recordset1['c_beizhu']; ?></td>
</tr>
<tr>
<td width="99%" colspan="3"><p align="center"><strong>物理化学性质</strong> </p></td>
</tr>
<tr>
<td width="99%" colspan="3"><p align="center"> </p></td>
</tr>
<tr>
<td width="29%"><p align="right">熔点 </p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><p align="left"><?php echo $row_Recordset1['c_rongdian']; ?>oC</p></td>
</tr>
<tr>
<td width="29%"><p align="right">水溶性 </p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><p align="left"><?php echo $row_Recordset1['c_rongjie']; ?> G/L (20 oC)</p></td>
</tr>
<tr>
<td width="29%"><p align="right"> </p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><p align="left"> </p></td>
</tr>
<tr>
<td width="99%" colspan="3"><p align="center"><strong>安全数据</strong> </p></td>
</tr>
<tr>
<td width="99%" colspan="3"><p align="center"> </p></td>
</tr>
<tr>
<td width="29%"><p align="right">危险品标志 </p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><p align="left"><?php echo $row_Recordset1['c_biaozhi']; ?> T;C <a href="http://www.chemblink.com/codes/hazardSymbolsC.pdf" target="_blank">说明</a> </p></td>
</tr>
<tr>
<td width="29%"><p align="right">危险类别码 </p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><p align="left"><?php echo $row_Recordset1['c_weixiandaima']; ?> <a href="http://www.chemblink.com/codes/riskC.pdf" target="_blank">说明</a> </p></td>
</tr>
<tr>
<td width="29%"><p align="right">安全说明 </p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><p align="left"><?php echo $row_Recordset1['c_anquan']; ?> <a href="http://www.chemblink.com/codes/safetyC.pdf" target="_blank">说明</a> </p></td>
</tr>
<tr>
<td width="29%"><p align="right">危险品运输编号 </p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><p align="left"> <?php echo $row_Recordset1['c_yunshino']; ?></p></td>
</tr>
<tr>
<td width="29%"><p align="right">MSDS</p></td>
<td width="1%"><p align="left"> </p></td>
<td width="67%"><p align="left"><a href="http://www.chemblink.com/MSDS/64-69-7_MSDSC.htm" target="_blank"><?php echo $row_Recordset1['c_mads']; ?></a></p></td>
</tr>
</table>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
我跳转的页面只这样的,,,现在只能输出固定的
<?phpheader('Content-Type: text/html; charset=gb2312');// 获取 表单提交过来的值
$select = empty($_POST['select'])?'':$_POST['select'];
$chaxun = trim($_POST['chaxun']);
$chaxun = empty($chaxun)?'':$chaxun;
// 连接数据库
mysql_connect("……");
// 查询数据
$sql = 'select * from table where ……';
$query = mysql_query($sql);//自己看情况处理
$res = mysql_fetch_array($query);
// 输出 查询结果
echo $res[0];?>
给个 例子$query_Recordset1 = "SELECT * FROM chanpinbiao where $select = '%{$chaxun}%' ";
// 获取 表单提交过来的值
$select = empty($_POST['select'])?'':$_POST['select'];
$chaxun = trim($_POST['chaxun']);
$chaxun = empty($chaxun)?'':$chaxun;
$query_Recordset1 = "SELECT * FROM chanpinbiao where $select = '%{$chaxun}%' ";
这样取 啊
上面那个 sql 语句 应该没错