Hi there, Am trying to filter results from my db, when i select a value i get no result and no error.I feel its my sql query, this is my code and form.

Or if any one have a simple script that can do the same,i will be grateful, thanks.
<table width="100%" border="0" cellspacing="1" cellpadding="1" align="left">
             <tr>
            <th scope="col" class="bodytxt" align="left">
            <a id="displayText" href="javascript:toggle();">Click To Filter by : [ Vehicle #, Destination and Driver's Name ]</a>
            <div id="toggleText" style="display: none">
         
<table width="100%" border="0" cellspacing="1" cellpadding="1" align="center">       
<tr>
<th scope="col" class="bodytxt" width="33%">
       <form action=verxbh738hmovx3z.php?nav=view method=post onsubmit='return validate1(this)'>
	 <table width=100%  border=0 cellspacing=1 cellpadding=1>
	<tr class='bodytxt'>
	
	 <td width=25% class="bodytxt">
	<label onClick="QA.style.display=QA.style.display=='none'? '' : 'none'">
          <input type='radio' name='find' value='date'></label>View Movement Log by Date
		<center>
		<DIV id=QA style="DISPLAY: none">
		Departure Date :<input name="date_out" readonly="Yes" class=textbox><img src=js/cal.gif  onclick="displayDatePicker('date_out', this);"><br>
		
Arrival Date :<input name="date_in" readonly="Yes" class=textbox><img src=js/cal.gif  onclick="displayDatePicker('date_in', this);">
						</center>
						  </Div>		</th>

              
<th width="25%" scope="col" class="bodytxt">	
<label onClick="QA1.style.display=QA1.style.display=='none'? '' : 'none'">
        
<input type='radio' name='find' value='driver'></label>View Movement Log by Driver's Name</strong>
			
<center>
			
 <DIV id=QA1 style="DISPLAY: none" class="bodytxt">Select Name :
		
 <select name='driver' class='bodytxt'>
			
<?php $query = "select distinct driver FROM movlog order by driver asc";
			
$result = mysql_query($query);
	
$num_results = mysql_num_rows($result);
		
while ($row = mysql_fetch_array($result))
			
{
										$s_country = $row['driver'];
										echo"<option>$s_country</option>";
		
}
		
?>
			
</select><br>
					
Arrival Date :<input name="c_startdate" readonly="Yes" class=textbox><img src=js/cal.gif  onclick="displayDatePicker('c_startdate', this);"><br>
	
Departure Date :<input name="c_enddate" readonly="Yes" class='textbox'><img src=js/cal.gif  onclick="displayDatePicker('c_enddate', this);">
						  </Div>
						 </center>	</th>
                                        <th width="25%" scope="col" class="bodytxt">
	
<label onClick="QA2.style.display=QA2.style.display=='none'? '' : 'none'">
	
<input type=radio name='find' value='vreg'></label>View Movement Log by Vehicle # </strong>
	
<DIV id=QA2 style="DISPLAY: none" class="bodytxt">Vehicle # :
								 <br>
                                 
    <?php
				  
		$query = "select distinct vreg FROM movlog";
		$movlog_result= mysql_query($query) or trigger_error("SQL", E_USER_ERROR);
		$movlog_num = 0;
		$movlog_num = mysql_numrows($movlog_result);
		$i = 0;
		$x = 0;
	
	    while($i < $movlog_num) 
			{
				$id = mysql_result($movlog_result,$i,"vreg");
				$x = $x + 1;
				$i++;
			}
?>
	
<script language="javascript">
						
					
locations_text = new Array(<?=$x?>);
							
locations_text [0] = new Array(1)
						
//arrays for the text
							
 <?   
							 		
$movlog_num = $x+1;
									
$n = 1;
							 		
while($n < $movlog_num) 
									
{
										echo"locations_text [$n] = new Array(1);";
										
$n++;
									
}
							
?>
							
//arrays for values	
							
locations_values = new Array(<?=$x?>);
	locations_values [0] = new Array(1)	
			<?
									
		$movlog = $x+1;
			$m = 1;
				while($m < $movlog) 
		{
										echo"locations_values [$m] = new Array(1);";
			$m++;
				}		
									
		$queryfnum = "select distinct vreg FROM movlog order by vreg";
			$movlog_result4= mysql_query($queryfnum) or trigger_error("SQL", E_USER_ERROR);
		$movlog_num4 = 0;
		$movlog_num4 = mysql_numrows($movlog_result4);
			$i = 0;
			$z = 1;
			$today_date = date("y-m-d");
							
		 while($i < $movlog_num4) 
	{
			$vreg = mysql_result($movlog_result4,$i,"vreg");
									
													$query1 = "select id,vreg,desti FROM movlog where vreg='$vreg' order by desti";
													$result1 = mysql_query($query1);
													$y = 0;
													$num_results = mysql_num_rows($result1);
													while ($row = mysql_fetch_array($result1))
													{
														$fid = $row['id'];
														$id = $row['origin'];
														$vreg = $row['vreg'];
														$desti = $row['desti'];

														list($dy, $dm, $dd) = split('[/.-]', $dept);
															$query2 = "select * from movlog where id='$id'";
															$result2 = mysql_query($query2);
															$num_results = mysql_num_rows($result2);
															while ($row = mysql_fetch_array($result2))
															{
																$town = $row['desti'];
																$chkorigin = $town;
															}	
															
															$query3 = "select * FROM movlog where desti='$desti'";
															$result3 = mysql_query($query3);
															$num_results = mysql_num_rows($result3);
															while ($row = mysql_fetch_array($result3))
															{
																$town = $row['desti'];
																$chkdestination = $town;
															}	
															echo "locations_text [$z][$y] = '$vreg » $chkorigin - $chkdestination » $dd-$dm-$dy';";
															echo "locations_values [$z][$y] = '$fid';";
													 $y = $y + 1;
													}		
			 $z = $z + 1;
			$i++;
									     }			
		?>
						
							//============================================
	//function to write the locations
						
		function writeLocations11(theObject)
			{
				theForm = theObject.form;
			var regionnum=theForm.region11.selectedIndex;
							
								theForm.vreg.selectedIndex = 0;
	
for ( x=0;x<locations_text[regionnum].length;x++)
	
 {
								 theForm.vreg.options[x] = new Option(locations_text[regionnum][x], locations_values[regionnum][x]);
								 }
							
			theForm.vreg.length = x;
			theForm.vreg.focus();
				
}
							
		//-->
				</script>		      
                       <select class=textbox name="region11" onChange="JavaScript:writeLocations11(this);">
		<option value="null">--select--</option>
											<?php
	$query = "select id,vreg FROM movlog order by vreg";
										$movlog_result= mysql_query($query) or trigger_error("SQL", E_USER_ERROR);
										$movlog_num = 0;
										$movlog_num = mysql_numrows($movlog_result);
				
$i = 0;
	$x = 0;
		$tempvreg = "";
		 while($i < $movlog_num) 
											{
												$vreg = mysql_result($movlog_result,$i,"vreg");
												$fid = mysql_result($movlog_result,$i,"id");
												if($vreg != $tempvreg)
												{
													echo"<option value='$fid'>$vreg</option>";
													$tempvreg = $vreg;
												}
												$i++;
											}
    ?>
               </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
				 Vehicles Available <font color=red>*</font>
					<select name="vreg" class=textbox>
											<option value="null">--select--</option>
										</select>
						  </Div>
						 </center>		
                         </th>
                       <th width="25%" scope="col" class="bodytxt">
                       <label onClick="QA3.style.display=QA3.style.display=='none'? '' : 'none'">
                  <input type='radio' name='find' value='desti'>
                  </label>View Movement Log by Destination</strong>
			<center>
			<DIV id=QA3 style="DISPLAY: none" class="bodytxt">Select Destination :
			<select name='desti' class='bodytxt'>
			<?php $query = "select distinct desti FROM movlog order by desti asc";
				$result = mysql_query($query);
				$num_results = mysql_num_rows($result);
				while ($row = mysql_fetch_array($result))
				
{
										$s_country = $row['desti'];
										echo"<option>$s_country</option>";
				}
			?>
				</select><br>
			
Arrival Date :<input name="cstartdate" readonly="Yes" class=textbox><img src=js/cal.gif  onclick="displayDatePicker('cstartdate', this);"><br>
	
Departure Date :<input name="cenddate" readonly="Yes" class='textbox'><img src=js/cal.gif  onclick="displayDatePicker('cenddate', this);">
						  </Div>
						 </center>	</th>
                                      </tr>
                                </table>
                     <?php echo"
			
<table width='100%' border='0' cellspacing='1' cellpadding='1' align='center'>

												<tr>
		      <td colspan=8><div align=center><hr /></div></td>
		    </tr>
			<tr align=center><br><br>
      			<td colspan=5><br><br><input name=Submit type=submit class=bottom value=Submit>
				<input name=Reset type=reset class=bottom value=Reset>
          		
      		</td>
    </tr>
		  </table>
		    </form>";?>
					</form>
			                </th>
                             	 </tr>
                            		</table>
					
                    	                   </div>
                                        </td>
									</th>
                                      </tr>
                                    </table>
       <table width="100%" border="0" cellspacing="1" cellpadding="1">
                                      <tr>
                                        <th scope="col">
   <?php
        $date = "";
		$driver = "";
		$vreg = "";
		$desti = "";
		
		$radiotype = $_REQUEST['find'];	
		
				if ($radiotype == "")
		{
		echo"<p class='bodytxt'>N.B: You can filter by selecting any of the category of movement log you want to view.</p><br><br>
		";
		exit;
		}

				if ($radiotype == "date")
		{
			
	
			echo
			
					"
<table width='100%' border='0' cellspacing='1' cellpadding='1'>
				  <tr>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Vehicle #</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Mileage Out</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Mileage In</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Fuel Filled [Ltrs]</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Driver</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Fuel Cost (Gh ¢)</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Vehicle Type</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>View Details</font></th>
				  </tr>
				  </table>
					
						";	
					
			
			{

			
				$query = "select * FROM movlog order by id desc";
				$pager = new PS_Pagination($conn,$query,10,10);
				$accra = $pager->paginate();
				while($row = mysql_fetch_assoc($accra)) 
				{
					$id = $row['id'];
					
					$date_out = $_REQUEST['date_out'];
					$date_in = $_REQUEST['date_in'];
					list($d, $m, $y) = split('[/.-]', $date_out);
					list($ed, $em, $ey) = split('[/.-]', $date_in);
					$date_out = $y."-".$m."-".$d;
					$date_in = $ey."-".$em."-".$ed;
					
					$mileage_out = $row['mileage_out'];
					$mileage_in = $row['mileage_in'];
					$vreg = $row['vreg'];
					$ftype = $row['ftype'];
					$famount = $row['famount'];
					$driver = $row['driver'];
					$vtype = $row['vtype'];
					$dept = $row['dept'];
					$date_out = $row['date_out'];
					$date_in = $row['date_in'];
					$time_out = $row['time_out'];					
					$time_in = $row['time_in'];
					$tt_con = $row['tt_con'];
					$tf_con = $row['tf_con'];				
				}
		
		echo
			"

<table width='100%' align='center' border='0' cellspacing='1' cellpadding='1'>
						  <tr>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vreg</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$mileage_out</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$mileage_in</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$famount</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$driver</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vreg</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vtype</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'>
							<a href='verxbh738hmovx3z.php?nav=view&id=$id&zy9stxyw...' target='_blank'><img src='icon/view.gif' border='0'></a></td>
   </tr>
</table>


				";
		
			}
		}
		
			
				if ($radiotype == "driver")
		{
			
			echo
			
					"
<table width='100%' border='0' cellspacing='1' cellpadding='1'>
				  <tr>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Vehicle #</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Mileage Out</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Mileage In</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Fuel Filled [Ltrs]</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Driver</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Fuel Cost (Gh ¢)</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Vehicle Type</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>View Details</font></th>
				  </tr>
				  </table>
					
						";
		
			
			{
				//$query = "SELECT * FROM movlog where driver='$driver' dates BETWEEN '$date_out' and '$date_in'";
				$query= "SELECT * FROM movlog WHERE driver ='$driver' AND '$date_out' >= '$date_out' AND '$date_in' <= '$date_in'";
				$pager = new PS_Pagination($conn,$query,10,10);
				$accra = $pager->paginate();
				while($row = mysql_fetch_assoc($accra)) 
				{
					$id = $row['id'];
					$date_out = $_REQUEST['c_startdate'];
					$date_in = $_REQUEST['c_enddate'];
					list($d, $m, $y) = split('[/.-]', $date_out);
					list($ed, $em, $ey) = split('[/.-]', $date_in);
					$date_out = $y."-".$m."-".$d;
					$date_in = $ey."-".$em."-".$ed;
					
					$mileage_out = $row['mileage_out'];
					$mileage_in = $row['mileage_in'];
					$vreg = $row['vreg'];
					$ftype = $row['ftype'];
					$famount = $row['famount'];
					$driver = $row['driver'];
					$vtype = $row['vtype'];
					$dept = $row['dept'];
					$date_out = $row['date_out'];
					$date_in = $row['date_in'];
					$time_out = $row['time_out'];					
					$time_in = $row['time_in'];
					$tt_con = $row['tt_con'];
					$tf_con = $row['tf_con'];					
														
					
					
				}
				
				
			
		echo
			"

<table width='100%' align='center' border='0' cellspacing='1' cellpadding='1'>
						  <tr>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vreg</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$mileage_out</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$mileage_in</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$famount</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$driver</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vreg</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vtype</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'>
							<a href='verxbh738hmovx3z.php?nav=view&id=$id&zy9stxyw...' target='_blank'><img src='icon/view.gif' border='0'></a></td>
   </tr>
</table>


				";
		
			}
		}
		
		
					
				if ($radiotype == "vreg")
		{
			
			echo
			
					"
<table width='100%' border='0' cellspacing='1' cellpadding='1'>
				  <tr>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Vehicle #</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Mileage Out</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Mileage In</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Fuel Filled [Ltrs]</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Driver</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Fuel Cost (Gh ¢)</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Vehicle Type</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>View Details</font></th>
				  </tr>
				  </table>
					
						";
		
			
			{
				$query= "SELECT * FROM movlog WHERE vreg ='$vreg' order by driver desc";
				$pager = new PS_Pagination($conn,$query,10,10);
				$accra = $pager->paginate();
				while($row = mysql_fetch_assoc($accra)) 
				{
					$id = $row['id'];					
					$mileage_out = $row['mileage_out'];
					$mileage_in = $row['mileage_in'];
					$vreg = $row['vreg'];
					$ftype = $row['ftype'];
					$famount = $row['famount'];
					$driver = $row['driver'];
					$vtype = $row['vtype'];
					$dept = $row['dept'];
					$date_out = $row['date_out'];
					$date_in = $row['date_in'];
					$time_out = $row['time_out'];					
					$time_in = $row['time_in'];
					$tt_con = $row['tt_con'];
					$tf_con = $row['tf_con'];					
														
					
					
				}
				
				
			
		echo
			"

<table width='100%' align='center' border='0' cellspacing='1' cellpadding='1'>
						  <tr>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vreg</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$mileage_out</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$mileage_in</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$famount</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$driver</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vreg</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vtype</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'>
							<a href='verxbh738hmovx3z.php?nav=view&id=$id&zy9stxyw...' target='_blank'><img src='icon/view.gif' border='0'></a></td>
   </tr>
</table>


				";
		
			}
		}
		
				
				if ($radiotype == "desti")
		{
			
			echo
			
					"
<table width='100%' border='0' cellspacing='1' cellpadding='1'>
				  <tr>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Vehicle ##</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Mileage Out</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Mileage In</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Fuel Filled [Ltrs]</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Driver</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Fuel Cost (Gh ¢)</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>Vehicle Type</font></th>
					<th width='12.5' align='center' class='bodytxt' bgcolor='#330066'><font color='#ffffff'>View Details</font></th>
				  </tr>
				  </table>
					
						";
		
			
			{
				$query= "SELECT * FROM movlog WHERE desti ='$desti' BETWEEN '$date_out' AND '$date_in' order by desti desc";
				$pager = new PS_Pagination($conn,$query,10,10);
				$accra = $pager->paginate();
				while($row = mysql_fetch_assoc($accra)) 
				{
					$id = $row['id'];
					
					$date_out = $_REQUEST['cstartdate'];
					$date_in = $_REQUEST['cenddate'];
					list($d, $m, $y) = split('[/.-]', $date_out);
					list($ed, $em, $ey) = split('[/.-]', $date_in);
					$date_out = $y."-".$m."-".$d;
					$date_in = $ey."-".$em."-".$ed;
					
					$mileage_out = $row['mileage_out'];
					$mileage_in = $row['mileage_in'];
					$vreg = $row['vreg'];
					$ftype = $row['ftype'];
					$famount = $row['famount'];
					$driver = $row['driver'];
					$vtype = $row['vtype'];
					$dept = $row['dept'];
					$date_out = $row['date_out'];
					$date_in = $row['date_in'];
					$time_out = $row['time_out'];					
					$time_in = $row['time_in'];
					$tt_con = $row['tt_con'];
					$tf_con = $row['tf_con'];					
				}
		
		echo
			"

<table width='100%' align='center' border='0' cellspacing='1' cellpadding='1'>
						  <tr>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vreg</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$mileage_out</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$mileage_in</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$famount</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$driver</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vreg</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vtype</font></td>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'>
							<a href='verxbh738hmovx3z.php?nav=view&id=$id&zy9stxyw...' target='_blank'><img src='icon/view.gif' border='0'></a></td>
   </tr>
</table>


				";
		
			}
		}
		
	
						//Display the full navigation in one go
				echo"<table width=100%  border=0 cellspacing=4 cellpadding=1 bgcolor='#D6D6D6' class='bodyTxt'>
				<tr><td colspan=14 align=center ><br>" .$pager->renderFullNav(). "</td></tr></table>";								
	?>
                                     
                                        </th>
                                      </tr>
                                    </table>

Which query, there are so many? o_o' Have you tried to run your queries directly in MySQL shell or via PHPMyAdmin?

can any one help me with a script that filters multiple fields in a table?

Member Avatar for diafol

Would you like to resubmit your code with just the relevant bits? 621 lines is a bit much...

ok am doing that,

this is the form:

<form action=verxbh738hmovx3z.php?nav=view method=post onsubmit='return validate1(this)'>
			  <table width=100%  border=0 cellspacing=1 cellpadding=1>
			    <tr class='bodytxt'>
			      <td width=25% class="bodytxt">
				  <label onClick="QA.style.display=QA.style.display=='none'? '' : 'none'">
                  <input type='radio' name='find' value='date'></label>View Movement Log by Date
						<center>
						  <DIV id=QA style="DISPLAY: none">
							Departure Date :<input name="date_out" readonly="Yes" class=textbox><img src=js/cal.gif  onclick="displayDatePicker('date_out', this);"><br>
							Arrival Date :<input name="date_in" readonly="Yes" class=textbox><img src=js/cal.gif  onclick="displayDatePicker('date_in', this);">
						</center>
						  </Div>		</th>
                                        <th width="25%" scope="col" class="bodytxt">				  <label onClick="QA1.style.display=QA1.style.display=='none'? '' : 'none'">
                     <input type='radio' name='find' value='driver'></label>View Movement Log by Driver's Name</strong>
						<center>
						  <DIV id=QA1 style="DISPLAY: none" class="bodytxt">Select Name :
						  <select name='driver' class='bodytxt'>
							  	<?php $query = "select distinct driver FROM movlog order by driver asc";
									$result = mysql_query($query);
									$num_results = mysql_num_rows($result);
									while ($row = mysql_fetch_array($result))
									{
										$s_country = $row['driver'];
										echo"<option>$s_country</option>";
									}
								?>
							</select><br>
							Arrival Date :<input name="c_startdate" readonly="Yes" class=textbox><img src=js/cal.gif  onclick="displayDatePicker('c_startdate', this);"><br>
							Departure Date :<input name="c_enddate" readonly="Yes" class='textbox'><img src=js/cal.gif  onclick="displayDatePicker('c_enddate', this);">
						  </Div>
						 </center>	</th>
                                        <th width="25%" scope="col" class="bodytxt">
			<label onClick="QA2.style.display=QA2.style.display=='none'? '' : 'none'">
			<input type=radio name='find' value='vreg'></label>View Movement Log by Vehicle # </strong>
						  <DIV id=QA2 style="DISPLAY: none" class="bodytxt">Vehicle # :
								 <br>
                                 
    <?php
				  
		$query = "select distinct vreg FROM movlog";
		$movlog_result= mysql_query($query) or trigger_error("SQL", E_USER_ERROR);
		$movlog_num = 0;
		$movlog_num = mysql_numrows($movlog_result);
		$i = 0;
		$x = 0;
	
	    while($i < $movlog_num) 
			{
				$id = mysql_result($movlog_result,$i,"vreg");
				$x = $x + 1;
				$i++;
			}
?>
						<script language="javascript">
						
							locations_text = new Array(<?=$x?>);
							locations_text [0] = new Array(1)
						//arrays for the text
							 <?   
							 		$movlog_num = $x+1;
									$n = 1;
							 		while($n < $movlog_num) 
									{
										echo"locations_text [$n] = new Array(1);";
										$n++;
									}
							?>
							//arrays for values	
							locations_values = new Array(<?=$x?>);
							locations_values [0] = new Array(1)	
							<?
									
							 		$movlog = $x+1;
									$m = 1;
							 		while($m < $movlog) 
									{
										echo"locations_values [$m] = new Array(1);";
										$m++;
									}		
									
								$queryfnum = "select distinct vreg FROM movlog order by vreg";
								$movlog_result4= mysql_query($queryfnum) or trigger_error("SQL", E_USER_ERROR);
								$movlog_num4 = 0;
								$movlog_num4 = mysql_numrows($movlog_result4);
								$i = 0;
								$z = 1;
								$today_date = date("y-m-d");
							
							    while($i < $movlog_num4) 
									{
									   $vreg = mysql_result($movlog_result4,$i,"vreg");
													//$query1 = "select id,vreg FROM movlog where isshow='Yes' and fnum='$fnum' order by fnum,dept";
													$query1 = "select id,vreg,desti FROM movlog where vreg='$vreg' order by desti";
													$result1 = mysql_query($query1);
													$y = 0;
													$num_results = mysql_num_rows($result1);
													while ($row = mysql_fetch_array($result1))
													{
														$fid = $row['id'];
														$id = $row['origin'];
														$vreg = $row['vreg'];
														$desti = $row['desti'];

														list($dy, $dm, $dd) = split('[/.-]', $dept);
															$query2 = "select * from movlog where id='$id'";
															$result2 = mysql_query($query2);
															$num_results = mysql_num_rows($result2);
															while ($row = mysql_fetch_array($result2))
															{
																$town = $row['desti'];
																$chkorigin = $town;
															}	
															
															$query3 = "select * FROM movlog where desti='$desti'";
															$result3 = mysql_query($query3);
															$num_results = mysql_num_rows($result3);
															while ($row = mysql_fetch_array($result3))
															{
																$town = $row['desti'];
																$chkdestination = $town;
															}	
															echo "locations_text [$z][$y] = '$vreg » $chkorigin - $chkdestination » $dd-$dm-$dy';";
															echo "locations_values [$z][$y] = '$fid';";
													 $y = $y + 1;
													}		
										 $z = $z + 1;
										$i++;
									}			
										
								?>
						
							//============================================
							//function to write the locations
						
							function writeLocations11(theObject)
							{
								theForm = theObject.form;
								var regionnum=theForm.region11.selectedIndex;
							
								theForm.vreg.selectedIndex = 0;
								for ( x=0;x<locations_text[regionnum].length;x++)
								 {
								 theForm.vreg.options[x] = new Option(locations_text[regionnum][x], locations_values[regionnum][x]);
								 }
							
								theForm.vreg.length = x;
								theForm.vreg.focus();
							}
							
						//-->
						</script>		      
                       <select class=textbox name="region11" onChange="JavaScript:writeLocations11(this);">
						<option value="null">--select--</option>
											<?php
										$query = "select id,vreg FROM movlog order by vreg";
										$movlog_result= mysql_query($query) or trigger_error("SQL", E_USER_ERROR);
										$movlog_num = 0;
										$movlog_num = mysql_numrows($movlog_result);
										$i = 0;
										$x = 0;
									    $tempvreg = "";
									    while($i < $movlog_num) 
											{
												$vreg = mysql_result($movlog_result,$i,"vreg");
												$fid = mysql_result($movlog_result,$i,"id");
												if($vreg != $tempvreg)
												{
													echo"<option value='$fid'>$vreg</option>";
													$tempvreg = $vreg;
												}
												$i++;
											}
								?>
                                </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
								 Vehicles Available <font color=red>*</font>
						                <select name="vreg" class=textbox>
											<option value="null">--select--</option>
										</select>
						  </Div>
						 </center>		
                         </th>
                       <th width="25%" scope="col" class="bodytxt">
                       <label onClick="QA3.style.display=QA3.style.display=='none'? '' : 'none'">
                  <input type='radio' name='find' value='desti'>
                  </label>View Movement Log by Destination</strong>
						<center>
						  <DIV id=QA3 style="DISPLAY: none" class="bodytxt">Select Destination :
						  <select name='desti' class='bodytxt'>
							  	<?php $query = "select distinct desti FROM movlog order by desti asc";
									$result = mysql_query($query);
									$num_results = mysql_num_rows($result);
									while ($row = mysql_fetch_array($result))
									{
										$s_country = $row['desti'];
										echo"<option>$s_country</option>";
									}
								?>
							</select><br>
							Arrival Date :<input name="cstartdate" readonly="Yes" class=textbox><img src=js/cal.gif  onclick="displayDatePicker('cstartdate', this);"><br>
							Departure Date :<input name="cenddate" readonly="Yes" class='textbox'><img src=js/cal.gif  onclick="displayDatePicker('cenddate', this);">
						  </Div>
						 </center>	</th>
                                      </tr>
                                </table>
                                			    <?php echo"
								<table width='100%' border='0' cellspacing='1' cellpadding='1' align='center'>

												<tr>
		      <td colspan=8><div align=center><hr /></div></td>
		    </tr>
			<tr align=center><br><br>
      			<td colspan=5><br><br><input name=Submit type=submit class=bottom value=Submit>
				<input name=Reset type=reset class=bottom value=Reset>
          		
      		</td>
    </tr>
		  </table>
		    ";?>
					</form>
			                </th>
                             	 </tr>
                            		</table>

and the is the php script doing the filtering:

<?php		
        
		$date = "";
		$driver = "";
		$vreg = "";
		$desti = "";
		
		$radiotype = $_REQUEST['find'];		
		
		if ($radiotype == "")
		{
		echo"<p class='bodytxt'>N.B: You can filter by selecting any of the category of movement log you want to view.</p><br><br>
		";
		exit;
		}
		if($radiotype == "date")
		{
					$date_out = $_REQUEST['date_out'];
					$date_in = $_REQUEST['date_in'];
					list($d, $m, $y) = split('[/.-]', $date_out);
					list($ed, $em, $ey) = split('[/.-]', $date_in);
					$date_out = $y."-".$m."-".$d;
					$date_in = $ey."-".$em."-".$ed;
		}
		elseif ($radiotype == "driver")
		{
			$desti = $_REQUEST['desti'];
					$date_out = $_REQUEST['c_startdate'];
					$date_in = $_REQUEST['c_enddate'];
					list($d, $m, $y) = split('[/.-]', $date_out);
					list($ed, $em, $ey) = split('[/.-]', $date_in);
					$date_out = $y."-".$m."-".$d;
					$date_in = $ey."-".$em."-".$ed;			
		}
		
		elseif ($radiotype == "vreg")
		{
		{
			$vreg = $_REQUEST['vreg'];
		}
			$movlog_num = 0;
			$movlog_result = mysql_QUERY("select * FROM movlog order by cur_date asc"); 
			$i = 0;
		
		}

				elseif ($radiotype == "desti")
		{
					$date_out = $_REQUEST['cstartdate'];
					$date_in = $_REQUEST['cenddate'];
					list($d, $m, $y) = split('[/.-]', $date_out);
					list($ed, $em, $ey) = split('[/.-]', $date_in);
					$date_out = $y."-".$m."-".$d;
					$date_in = $ey."-".$em."-".$ed;			
		}

	  echo "<center>
	  		<p><br><strong>Sales</strong></p>
			  <table width=100%  border=0 cellspacing=3 cellpadding=0>";
						
						if($radiotype == "date")
						
					{
						$query = "SELECT * FROM movlog where between '$date_in' and '$date_out'";
					}
					
					elseif ($radiotype == "desti")
					
					{
						$query = "SELECT * FROM movlog where desti='$desti' between '$date_out' and '$date_in'";
					}
					
					elseif ($radiotype == "driver")
					
					{
						$query = "SELECT * FROM movlog where driver='$driver' between '$date_out' and '$date_in'";
					}
					
					elseif ($radiotype == "vreg")
					{
						$totalquery = "SELECT * FROM movlog where vreg='$vreg'";
						$date_out = "";
						$date_in =  "";
					}
		
					$query_result= mysql_query($query) or trigger_error("SQL", E_USER_ERROR);
					$query_result_num = 0;
					$query_result_num = mysql_numrows($query_result);
					$i = 0;

					while($i < $query_result_num) 
						{
							$query_result = mysql_result($query_result,$i);
							$i++;
						}	
			   
			   echo
			       "
				   
<table width='100%' align='center' border='0' cellspacing='1' cellpadding='1'>
						  <tr>
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vreg</font></td>
							
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$mileage_out</font></td>
							
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$mileage_in</font></td>
							
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$famount</font></td>
							
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$driver</font></td>
							
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vreg</font></td>
							
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vtype</font></td>
							
							<td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'>
							<a href='verxbh738hmovx3z.php?nav=view&id=$id&zy9stxyw...' target='_blank'><img src='icon/view.gif' border='0'></a></td>
   </tr>
</table>
				  
				  ";
                           
           	
						//Display the full navigation in one go
				echo"<table width=100%  border=0 cellspacing=4 cellpadding=1 bgcolor='#D6D6D6' class='bodyTxt'>
				<tr><td colspan=14 align=center ><br>" .$pager->renderFullNav(). "</td></tr></table>";	
			  ?>                         
                                        </th>
                                      </tr>
                                    </table>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.