<?php 
$active = 'Enquiry';
$pageName = 'Enquiry';

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

include('hitCounter.php');

$obj = new DBClass();

if(isset($_POST['submit']) && $_POST['submit'] == 'Submit'){

	$valid = checkName($_POST['name'], "Name"); if(isset($valid) && $valid != ''){ $error[] = $valid;}
	$valid = checkEmail($_POST['email'], "Email"); if(isset($valid) && $valid != ''){ $error[] = $valid;}
	$valid = validmess($_POST['phone'], "Phone No."); if(isset($valid) && $valid != ''){ $error[] = $valid;}
	$valid = validmess($_POST['mobile'], "Mobile No."); if(isset($valid) && $valid != ''){ $error[] = $valid;}
	$valid = validmess($_POST['requirement'], "Requirement"); if(isset($valid) && $valid != ''){ $error[] = $valid;}
	
	if($error == ''){

		// *********************** start  mail to admin *****************
		$to        	= 	'shrinetrainfotech@gmail.com';
		$subject	=	"Coalbazaar enquiry About".@$_POST['requirement'];
		$message	= 	"The Details are  :-               <br>".
		"--------------------------------------------------------------------------------<br>".
		"Name		: ".@$_POST['name']. "  		<br>".
		"Email Address 	: ".@$_POST['email']. "  	  <br>".		
		"Phone		 	: ".@$_POST['phone']. "  	  <br>".		
		"Mobile		 	: ".@$_POST['mobile']. "  	  <br>".		
		"Requirement 	: ".@$_POST['requirement']. "  	  <br>".	
		"Message	: ".@$_POST['comment']. "  	<br>".
		"--------------------------------------------------------------------------------<br>";
		// To send HTML mail, the Content-type header must be set
		$headers  = 'MIME-Version: 1.0' . "\r\n";
		$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
		// Additional headers
		//$headers .= 'To: ' "\r\n";
		$headers .= 'From: '.$_POST['name'].'<'.$_POST['email'].'>' . "\r\n";
		@$sended=mail($to, $subject, $message, $headers);
		
		@header('Location: enquiry.php?action=done');
		
		mysql_query("insert into enquiry (name,email,phone,mobile,requirement,comment) values ('".$_POST['name']."','".$_POST['email']."','".$_POST['phone']."','".$_POST['mobile']."','".$_POST['requirement']."','".$_POST['comment']."')");
	}
}
?>


<!--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>Enquiry</h2>
						<div class="err_msg"><?php ShowError($error); ShowInfo($info);?></div>

						<?php if(isset($_GET['action']) && $_GET['action'] == 'done') { ?>
								<div class="err_msg">Thanks for showing interest on us,we will revert you soon.</div>
						<?php } else { ?>
						
						
								<form name="contact" method="POST" action="">
										<table>
												<tr>
														<td width="150">Name<span class="style1">*</span></td>
														<td><input name="name" type="text" class="txt_box2"/></td>
												</tr>
												<tr>
														<td>E-mail Address<span class="style1">*</span></td>
														<td><input name="email" type="text"  class="txt_box2"/></td>
												</tr>
												<tr>
														<td>Phone<span class="style1">*</span></td>
														<td><input name="phone" type="text"  class="txt_box2"/></td>
												</tr>
												<tr>
														<td>Mobile<span class="style1">*</span></td>
														<td><input name="mobile" type="text" class="txt_box2"/></td>
												</tr>
												<tr>
														<td>Requirement<span class="style1">*</span></td>
														<td>
																<select name="requirement" class="txt_box2">
																	<option value="">--Select Requirement--</option>
																	<option value="Call Us">Call Us</option>
																	<option value="coal procurement / Purchase">coal procurement / Purchase</option>
																	<option value="Email Company Brochures">Email Company Brochures</option>
																	<option value="Advertisement Details">Advertisement Details</option>
																	<option value="Registration request">Registration request</option>
																	<option value="SMS Company Basic Details">SMS Company Basic Details</option>
																	<option value="Send Offer as Hard Copy">Send Offer as Hard Copy</option>
																</select>
														</td>
												</tr>
												<tr>
														<td valign="top">Details<span class="style1">*</span></td>
														<td><textarea name="comment" rows="3" cols="18"  class="txt_box2"></textarea></td>
												</tr>
												<tr>
														<td align="left" colspan="2"><input type="submit" name="submit" class="login_btn" value="Submit" />
												</tr>
										</table>
								</form>
							
					<?php } ?>
						<br /><br /><br />

						<div class="contact_rt">
								<div class="gmap">
								
										<iframe width="545" height="295" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.co.in/maps?hl=en&amp;ie=UTF8&amp;t=m&amp;ll=22.770112,75.900003&amp;spn=0.001187,0.002918&amp;z=18&amp;iwloc=lyrftr:m,3535233191218996050,22.769192,75.899413&amp;output=embed"></iframe><br /><small><a href="https://maps.google.co.in/maps?hl=en&amp;ie=UTF8&amp;t=m&amp;ll=22.770112,75.900003&amp;spn=0.001187,0.002918&amp;z=18&amp;iwloc=lyrftr:m,3535233191218996050,22.769192,75.899413&amp;source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>
										
								</div>
						</div>
						
						
						

						</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');?>