PK

ADDRLIN : /home/anibklip/ldhcgewc.org/cms/
FLL :
Current File : /home/anibklip/ldhcgewc.org/cms/add_cgoffice.php

<center>
<?php
if($_POST[submt_btn] == 1){
	/////////////////////////////////// add record starts //////////////////////
	if($_POST[doAction] == "add"){
		$query="insert into cgoffice set 
			name='".mysql_escape_string($_POST[name])."', 
			address='".mysql_escape_string($_POST[address])."', 
			city='".mysql_escape_string($_POST[city])."', 
			pincode='".mysql_escape_string($_POST[pincode])."', 
			phone='".mysql_escape_string($_POST[phone])."', 
			fax='".mysql_escape_string($_POST[fax])."', 
			email='".mysql_escape_string($_POST[email])."', 
			head_name='".mysql_escape_string($_POST[head_name])."', 
			desig='".mysql_escape_string($_POST[desig])."',
			des_phone='".mysql_escape_string($_POST[des_phone])."',
			website='".mysql_escape_string($_POST[website])."'
		";
		mysql_query($query) or die(mysql_error());
		$office_id=mysql_insert_id();
		$msg="CG Office Added Successfully";
	}
	/////////////////////////////////// add record ends //////////////////////

	/////////////////////////////////// update record starts //////////////////////
	//print_r($_POST);
	if($_POST[doAction] == "edit") {
		$query="update cgoffice set 
			name='".mysql_escape_string($_POST[name])."', 
			address='".mysql_escape_string($_POST[address])."', 
			city='".mysql_escape_string($_POST[city])."', 
			pincode='".mysql_escape_string($_POST[pincode])."', 
			phone='".mysql_escape_string($_POST[phone])."', 
			fax='".mysql_escape_string($_POST[fax])."', 
			email='".mysql_escape_string($_POST[email])."', 
			head_name='".mysql_escape_string($_POST[head_name])."', 
			desig='".mysql_escape_string($_POST[desig])."',
			des_phone='".mysql_escape_string($_POST[des_phone])."',
			website='".mysql_escape_string($_POST[website])."'
			where office_id = '$_GET[office_id]'
		";
		mysql_query($query) or die(mysql_error());
		$office_id=$_GET[office_id];
		$msg="CG Office Updated Successfully";
	}
	/////////////////////////////////// update record ends //////////////////////
}

//////////////////////  fetch data for edit starts ////////////////////////
$query = "select * from cgoffice where office_id = '$_GET[office_id]'";
$query = mysql_query($query) or die(mysql_error());
if($editrow=mysql_fetch_array($query)){}
//////////////////////  fetch data for edit ends ////////////////////////
?>
</center>

<!-- BEGIN PAGE LEVEL STYLES -->
<link rel="stylesheet" type="text/css" href="assets/global/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.css"/>
<link rel="stylesheet" type="text/css" href="assets/global/plugins/bootstrap-markdown/css/bootstrap-markdown.min.css">
<link rel="stylesheet" type="text/css" href="assets/global/plugins/bootstrap-summernote/summernote.css">
<!-- END PAGE LEVEL STYLES -->

<div class="page-content-wrapper">
	<div class="page-content">
		<!-- BEGIN PAGE HEADER-->
		<h3 class="page-title"><?php echo($_GET[office_id]?"Edit":"Add")?> CG Office<small></small></h3>
		<!-- END PAGE HEADER-->
		<!-- BEGIN PAGE CONTENT-->
		<div class="row">
			<div class="col-md-12">
				<!-- BEGIN EXTRAS PORTLET-->
				<?php if($msg){?><div class="alert alert-success display-show"><button class="close" data-close="alert"></button><?=$msg?></div><?php }?>

				<div class="portlet box blue-hoki">
					<div class="portlet-title">
						<div class="caption">
							<i class="fa fa-gift"></i><?php echo($_GET[office_id]?"Edit":"Add")?> CG Office
						</div>
						 
					</div>
					<div class="portlet-body form">
						<form class="form-horizontal form-bordered" enctype="multipart/form-data" method="post" >
							<input type="hidden" name="doAction" value="<?php echo ($_GET[office_id]!=""?"edit":"add")?>">
							<div class="form-body">

								<div class="form-group">
									<label class="control-label col-md-2">CG Office Name</label>
									<div class="col-md-10">
										<input type="text" class="form-control" required name="name" id="name" value="<?php echo $editrow[name];?>" />
									</div>
								</div>
																
								<div class="form-group">
									<label class="control-label col-md-2">Address</label>
									<div class="col-md-10">
										<input type="text" class="form-control" name="address" id="address" value="<?php echo $editrow[address];?>" />
									</div>
								</div>

								<div class="form-group">
									<label class="control-label col-md-2">City with Pincode</label>
									<div class="col-md-10">
										<input type="text" class="form-control" name="city" id="city" value="<?php echo $editrow[city];?>" />
									</div>
								</div>

								<!-- <div class="form-group">
									<label class="control-label col-md-2">Pincode</label>
									<div class="col-md-10">
										<input type="text" class="form-control" name="pincode" id="pincode" value="<?php echo $editrow[pincode];?>" />
									</div>
								</div> -->
								
								<div class="form-group">
									<label class="control-label col-md-2">Phone</label>
									<div class="col-md-10">
										<input type="text" class="form-control" name="phone" id="phone" value="<?php echo $editrow[phone];?>" />
									</div>
								</div>

								<!-- <div class="form-group">
									<label class="control-label col-md-2">Fax</label>
									<div class="col-md-10">
										<input type="text" class="form-control" name="fax" id="fax" value="<?php echo $editrow[fax];?>" />
									</div>
								</div> -->

								<div class="form-group">
									<label class="control-label col-md-2">Email</label>
									<div class="col-md-10">
										<input type="text" class="form-control" name="email" id="email" value="<?php echo $editrow[email];?>" />
									</div>
								</div>
								<div class="form-group">
									<label class="control-label col-md-2">Name of the Head & Designation</label>
									<div class="col-md-10">
										<input type="text" class="form-control" name="head_name" id="head_name" value="<?php echo $editrow[head_name];?>" />
									</div>
								</div>
								<!-- <div class="form-group">
									<label class="control-label col-md-2">Designation</label>
									<div class="col-md-10">
										<input type="text" class="form-control" name="desig" id="desig" value="<?php echo $editrow[desig];?>" />
									</div>
								</div> -->
								<div class="form-group">
									<label class="control-label col-md-2">Phone/Mobile</label>
									<div class="col-md-10">
										<input type="text" class="form-control" name="des_phone" id="des_phone" value="<?php echo $editrow[des_phone];?>" />
									</div>
								</div>

								<div class="form-actions">
									<div class="row">
										<div class="col-md-offset-2 col-md-10">
											<button type="submit" name="submt_btn" value="1" class="btn green"><i class="fa fa-check"></i> <?php echo ($_GET[office_id]!=""?"Update":"Submit")?></button>
											<button type="button" class="btn default">Cancel</button>
										</div>
									</div>
								</div>

							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
		 
		<!-- END PAGE CONTENT-->
	</div>
</div>
<!-- END CONTENT -->


PK 99