<?php 
$active = 'Related Services';
$pageName = 'Transporter';

require_once('config/config.php');
require_once(CLASS_DIR.'dbClass.php');
require_once(INCLUDES_DIR.'header.php');

include('hitCounter.php');

$obj = new DBClass();
$obj1 = new DBClass();
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="JqueryLoader.js" type="text/javascript"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/mootools/1.2.5/mootools-yui-compressed.js"></script>
<script type="text/javascript" src="citySelection.js"></script>


<!--workarea start------------------------->
<div class="workarea">
	<div class="workareatop">
		<img src="images/workareatopcorner_03.PNG" alt="" />
	</div>
	<!--workareamid start--------------------->
	<div class="workareamid">
		<div id="floatleft" style="width:590px; float:left;">
			<div class="welcomediv">

                        <h2>Transportation & logistics</h2>
						<div id="preloader" style="margin-top:35px;margin-left:50px;"><img src="ajax_loader.gif" style="border:none;"/></div>               
						<div class="err_msg"><?php ShowError($error); ShowInfo($info);?></div>

<form name="liasoning" action="" method="post">
		<table border="0" cellspacing="0" cellpadding="0">
				<tr>
						<td>
							<select name="work_state" id="work_state" class="txt_box2" style="width:140px;">
								<option value="">--Select State--</option>
									<?php 
									$sql2 = "SELECT DISTINCT(work_state) as work_state FROM ".TBL_TRANSPORTER." where `work_state`!='' order by work_state ASC";
									$rs2 = $obj1->executeQry($sql2,$link);
									while($row2 = $obj1->fetchrow()){ 
									?>
								<option value="<?php echo $row2['work_state'];?>" <?php if($_POST['work_state'] == $row2['work_state']) echo 'selected'; ?>><?php echo $row2['work_state'];?></option>
									<?php } ?>
							</select>
						</td>
						<td>
							<select id="work_district" name="work_district" class="txt_box2" style="width:140px;">
								<option value="">--Select District--</option>
									<?php 
									$sql2 = "SELECT DISTINCT(work_district) as work_district FROM ".TBL_TRANSPORTER." where `work_district`!='' order by work_district ASC";
									$rs2 = $obj1->executeQry($sql2,$link);
									while($row2 = $obj1->fetchrow()){ 
									?>          
								<option value="<?php echo $row2['work_district'];?>" <?php if($_POST['work_district'] == $row2['work_district']) echo 'selected'; ?>><?php echo $row2['work_district'];?></option>
									<?php } ?>
							</select>
						</td>
						<td width="100" align="center">
							<input type="submit" name="submit" class="login_btn" style="width:60px;height: 25px;" value="Find"/>
						</td>
				</tr>
		</table>
</form>
<br /><br />
<?php 
if(isset($_POST['submit']) && $_POST['submit'] == 'Find'){

	$valid = validmess($_POST['work_state'], "State"); if(isset($valid) && $valid != ''){ $error[] = $valid;}	
	$valid = validmess($_POST['work_district'], "District"); if(isset($valid) && $valid != ''){ $error[] = $valid;}
	if($error != '') { ?>
	<div class="err_msg"><?php ShowError($error); ShowInfo($info);?></div>
	<?php } else { 
		if(isset($_POST['submit'])) {
			$con = "";	
			if($_POST['work_state']!='') {
				$con = " AND work_state = '".$_POST['work_state']."' ";	
			}
			if($_POST['work_district']!='') {
				$con .= " AND work_district = '".$_POST['work_district']."' ";	
			}
		
		$sql = "SELECT * FROM ".TBL_TRANSPORTER." WHERE status = '0' $con limit 0,4";
		$rs = $obj->executeQry($sql,$link);
		$i=1;
		}
	?>
<table class="main" width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
			<td class="bdr1" >
					<table width="100%"  border="0" cellspacing="0" cellpadding="0">
						<?php if($i==1) { ?>
						<tr>
								<td bgcolor="#990066" colspan="2" class="form_head" style="padding-left:5px"><span style="text-align: left;font-size: small;font-family: Tahoma;color:#000000;font-weight:bold;">Transporter</span></td>
						</tr>
						<?php }
							if($obj->getrow()>0) { 	
						?>
						<tr class="bg_td1">
							<?php
								while($row = $obj->fetchrow()) { 
							?>
								<td class="list_link" width="49%" align="left" valign="top" style="margin:5px;padding:5px;">
										<table>
											<tr>
												<td colspan="2"  style="text-align: left;font-size: small;font-family: Tahoma;color:#000000;"><b><?php echo $row['person_name'].' ('.$row['organisation_name'].')';?></b></td>
											</tr>
											<tr>
												<td style="font-size: x-small;font-family: Tahoma;color:#000000;" valign="top"><b>Address</b></td>
												<td style="font-size: x-small;font-family: Tahoma;color:#000000;"><?php echo $row['address'];?>, <?php echo $row['district'];?>, <?php echo $row['state'];?> - <?php echo $row['pincode'];?></td>
											</tr>
											<tr>
												<td style="font-size: x-small;font-family: Tahoma;color:#000000;"><b>Phone</b></td>
												<td style="font-size: x-small;font-family: Tahoma;color:#000000;"><?php echo $row['phone'];?></td>
											</tr>
											<tr>
												<td style="font-size: x-small;font-family: Tahoma;color:#000000;"><b>Fax</b></td>
												<td style="font-size: x-small;font-family: Tahoma;color:#000000;"><?php echo $row['fax'];?></td>
											</tr>
											<tr>
												<td style="font-size: x-small;font-family: Tahoma;color:#000000;"><b>Mobile</b></td>
												<td style="font-size: x-small;font-family: Tahoma;color:#000000;"><?php echo $row['mobile1'];?>, <?php echo $row['mobile2'];?></td>
											</tr>
											<tr>
												<td style="font-size: x-small;font-family: Tahoma;color:#000000;"><b>Email</b></td>
												<td style="font-size: x-small;font-family: Tahoma;color:#000000;"><?php echo $row['email1'];?>, <?php echo $row['email2'];?></td>
											</tr>
											<tr>
												<td style="font-size: x-small;font-family: Tahoma;color:#000000;"><b>Website</b></td>
												<td style="font-size: x-small;font-family: Tahoma;color:#000000;"><?php echo $row['website'];?></td>
											</tr>
										</table>
								</td>
								<?php 
								if($i%2==0) { 	echo '</tr><tr>'; 
								}
								$i++;
								} ?>
						</tr>
						<?php } else { ?>
						<tr>
                            	<td colspan="2" align="center" style="padding-left:5px;color:#D40000">Record Not found!</td>
						</tr>
						<?php 	} ?>
					</table>
			</td>
	</tr>
</table>
<table>							
	<tr>
		<td height="5" style="border:none"></td>
	</tr>
</table>
<?php 	} } ?>   		
					



						</div>
				</div>
				<?php require_once(INCLUDES_DIR.'left_bar.php');?>
                <!--floatright close-------------------->
                <div style="clear:both;"></div>
            </div>
            <!--workareamid close--------------------->
            <div class="workareabottom">
                <img src="images/workareabottomcorner_03.PNG" alt="" />
            </div>
        </div>
    <!--workarea close------------------------->
<?php require_once(INCLUDES_DIR.'footer.php');?>