21,886
社区成员
发帖
与我相关
我的任务
分享
<form action=" " method="get" name="form2" >
<input name="township" type="text" class="textbox" size="8">
<input name="rng" type="text" class="textbox" size="8">
<input name="dir" type="text" class="textbox" size="8">
<input name="section" type="text" class="textbox" size="8">
<input type="submit" name="submit" value="Submit">
</form>
<?php
$map = array ('Township' => 'township', 'Rng1' => 'rng', 'Direction' => 'dir', 'Section' => 'section' );
$where = '';
$and = '';
foreach ( $map as $k =>$v ) { if(!empty($_GET[$v])) { $where .= $and . $k ."= '".$_GET [$v]."'";$and = ' and ';}}
$query =" SELECT Business_Owner,On_Site_Manager,On_Site_Phone,Business_Name,Mailing_Address,Phone_Number,Crop_Type,Crop_Location,Section,Township,Rng1,Direction,Quarter,Acreage,County,Date_Of_Entry,Contact FROM data_query ";
if (!empty($where )) {$query .= ' WHERE ' . $where . ' ORDER BY County, Township, Rng1';}
?>