<?php
include 'header.php';
$page_nm = "Contact Us";
$pageUrl = "contact-us.php";


    
    if (isset($_POST['btn_submit'])) {

$email = $_POST['email'];
$person_name = $_POST['person_name'];
$mobile_1 = $_POST['mobile_1'];
$mobile_2 = $_POST['mobile_2'];
$address_1 = $_POST['address_1'];
$address_2 = $_POST['address_2'];
		

            $editqry = "UPDATE ".DB_PREFIX."contact_us SET 
                   email='".$email."',
				   person_name='".$person_name."',
				   mobile_1='".$mobile_1."',
				   mobile_2='".$mobile_2."',
				   address_1='".$address_1."',
				   address_2='".$address_2."' WHERE id='1'";
				   
            $ai_db->aiQuery($editqry);
			
			$ai_core->aiGoPage($pageUrl);
        
    }
  
$qry = "SELECT * FROM ".DB_PREFIX."contact_us WHERE id='1'";
$row = $ai_db->aiGetQueryObj($qry);
?>
<script src="<?php ADMIN_URL; ?>ckeditor/ckeditor.js"></script> 
<div class="main-panel">
    <div class="main-content">
        <div class="content-wrapper"><!-- Basic form layout section start -->
            <section id="horizontal-form-layouts">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="content-header">Manage <?php echo $page_nm; ?></div>
                    </div>
                </div>
               
                    <div class="row">
                        <div class="col-md-12">
                            <div class="card">
                                <div class="card-body">
                                    <div class="px-3">

                                        <form name="frm" id="frm" class="form form-horizontal" method="POST" action="" enctype="multipart/form-data" onsubmit="return chkFrm();">
                                            <h4 class="form-section"><i class="ft-life-buoy"></i>Contact Info</h4>
                                                
											<div class="form-group row">
												<label class="col-md-3 label-control">Email: </label>
												<div class="col-md-9">

												<input type="text" class="form-control" name="email" id="email" value="<?php echo $row[0]->email ?>" />
												</div>
											</div>
											
											<div class="form-group row">
												<label class="col-md-3 label-control">Contact Person Name: </label>
												<div class="col-md-9">

												<input type="text" class="form-control" name="person_name" id="person_name" value="<?php echo $row[0]->person_name ?>" />
												</div>
											</div>
											
											<div class="form-group row">
												<label class="col-md-3 label-control">Mobile 1: </label>
												<div class="col-md-9">

												<input type="text" class="form-control" name="mobile_1" id="mobile_1" value="<?php echo $row[0]->mobile_1 ?>" />
												</div>
											</div>
											
											<div class="form-group row">
												<label class="col-md-3 label-control">Mobile 2: </label>
												<div class="col-md-9">

												<input type="text" class="form-control" name="mobile_2" id="mobile_2" value="<?php echo $row[0]->mobile_2 ?>" />
												</div>
											</div>
											
											<div class="form-group row">
												<label class="col-md-3 label-control">Address: </label>
												<div class="col-md-9">
												<textarea class="form-control" name="address_1" id="address_1"><?php echo $row[0]->address_1 ?></textarea>

												</div>
											</div>
											
											
											<div class="form-group row">
												<label class="col-md-3 label-control">Warehouse Address: </label>
												<div class="col-md-9">

												<textarea class="form-control" name="address_2" id="address_2"><?php echo $row[0]->address_2 ?></textarea>
												</div>
											</div>
											
											
											
						</div>
						<div class="form-group row">
						<div class="col-md-3"></div>
						<div class="col-md-9">
                         
                                                <button type="submit" name="btn_submit" id="btn_submit" class="btn btn-raised btn-primary"><i class="fa fa-check-square-o"></i>Update</button>
												
                        </div>
						</div>						
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                

            </section>
            <!-- // Basic form layout section end -->
        </div>
    </div>
	
	
	
											
											
<?php include ('footer.php'); ?>
<script type="text/javascript">
function chkFrm()
{
	if(document.getElementById("email").value == "")
	{
		document.getElementById("email").focus();
		alert("Please enter email address.");
		return false;
	}
	if(document.getElementById("address_1").value == "")
	{
		document.getElementById("address_1").focus();
		alert("Please enter address.");
		return false;
	}
return true;
}
</script>
