<link href="wstyle.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<div align="center">
<? if ($_GET['stat'] == '' ) { ?>
  <form name="form1" method="post" action="index.php?page=22&stat=search">
    <table width="50%" border="0">
        <tr>
          <td class="td1">Search By</td>
          <td class="td2"><label>
<select name="search_by" id="search_by">
              <option value="Plate">Plate No</option>
              <option value="traf_recpt">Traf .Rcpt No.</option>
              <option value="cpr">CPR</option>
            <option value="mobile">Mobile</option>
            	
          </select>
          </label></td>
        </tr>
        <tr>
          <td class="td1">Search</td>
          <td class="td2"><span id="sprytextfield1">
            <label>
            <input type="text" name="Search" id="Search">
            </label>
          <span class="textfieldRequiredMsg">A value is required.</span></span></td>
        </tr>
    </table>
  </form>
 <? } if ( $_GET['stat'] == 'search' ) { ?>
<table width="100%" border="0" align="center">
    <tr>
      <td class="td1"><div align="center">Date</div></td>
      <td class="td1"><div align="center">Time</div></td>
      <td class="td1"><div align="center">Plate No.</div></td>
      <td class="td1"><div align="center">Type</div></td>
      <td class="td1"><div align="center">Number <br>
      of <br>
      Plate</div></td>
      <td class="td1"><div align="center">CPR</div></td>
      <td class="td1"><div align="center">Name</div></td>
      <td class="td1"><div align="center">Mobile</div></td>
      <td class="td1"><div align="center">Status</div></td>
      <td class="td1">Rack</td>
      <td class="td1">Remove</td>
    </tr>
		<?
            $result = mysql_query("SELECT *  FROM p1_order_info where  stop1 = 0 and ".$_POST['search_by']." = '".$_POST['Search']."'"); 
            while($row = mysql_fetch_array($result)){ 
        
        ?>
    <tr>
      <td class="td2"><div align="center"><? echo $row['Date_a']; ?></div></td>
      <td class="td2"><div align="center"><? echo $row['Time_a']; ?></div></td>
      <td class="td2"><div align="center"><? echo $row['Plate']; ?></div></td>
      <td class="td2"><div align="center"><?	
                        $result1 = mysql_query('select * from p1_plate_type where tyid = '.$row['Type1']); 
                        while($row1 = mysql_fetch_array($result1)){ 
                				echo $row1['plate_type'] ;
								
            
					}
				?></div></td>
      <td class="td2"><div align="center"><? echo $row['number_of_plate']; ?> </div></td>
      <td class="td2"><div align="center"><? echo $row['cpr']; ?> </div></td>
      <td class="td2"><div align="center"><? echo $row['Name']; ?> </div></td>
      <td class="td2"><div align="center"><? echo $row['mobile']; ?> </div></td>
      <td class="td2"><div align="center"><? 
						if ($row['status']=='0' ) {
							echo 'Factory';
						}	
						if ($row['status']=='1' ) {
							echo 'Delivery';
						}	
						if ($row['status']=='2' ) {
							echo 'Fixing';
						}	
						if ($row['status']=='3' ) {
							echo 'Finish';
						}	
						 ?></div></td>
      <td class="td2"><div align="center"><? echo $row['Rack'];	 ?></div>      </td>
      <td class="td2"><a href="index.php?page=22&stat=remove&oid=<? echo $row['oid'];?>" class="link">Remove</a></td>
    </tr>
    
		<?
			}
		?>    
  </table>
  
<? } ?>
</div>