ok

Mini Shell

Direktori : /proc/thread-self/root/home2/selectio/www/lilyexpresslive/software/admin/
Upload File :
Current File : //proc/thread-self/root/home2/selectio/www/lilyexpresslive/software/admin/pincode-edit.php

<?php require_once('header.php'); ?>

<?php
if(isset($_POST['form1'])) {
	$valid = 1;

	if(empty($_POST['pincode'])) {
		$valid = 0;
		$error_message .= 'Pincode can not be empty<br>';
	}

	if(empty($_POST['city'])) {
		$valid = 0;
		$error_message .= 'City can not be empty<br>';
	}
		if(empty($_POST['service'])) {
		$valid = 0;
		$error_message .= 'Service can not be empty<br>';
	}
		if(empty($_POST['state'])) {
		$valid = 0;
		$error_message .= 'State can not be empty<br>';
	}

	/*if(empty($_POST['tat'])) {
		$valid = 0;
		$error_message .= 'TAT can not be empty<br>';
	}*/
		if(empty($_POST['areacode'])) {
		$valid = 0;
		$error_message .= 'Area Code can not be empty<br>';
	}


	if($valid == 1) {
	    //date_default_timezone_set('Asia/Kolkata');
$date = date('Y-m-d h:i:s');

        	$statement = $pdo->prepare("UPDATE pincode SET pin_code=?, city=?,state=?, service=?, air=?, road=?, tat=?, area_code=?,upated_At=? WHERE id=?");
    		$statement->execute(array($_POST['pincode'],$_POST['city'],$_POST['state'],$_POST['service'],$_POST['air'],$_POST['road'],$_POST['tat'],$_POST['areacode'],$date,$_REQUEST['id']));

	    $success_message = 'Pincode is updated successfully!';
	}
}
?>

<?php
if(!isset($_REQUEST['id'])) {
	header('location: logout.php');
	exit;
} else {
	// Check the id is valid or not
	$statement = $pdo->prepare("SELECT * FROM pincode WHERE id=?");
	$statement->execute(array($_REQUEST['id']));
	$total = $statement->rowCount();
	$result = $statement->fetchAll(PDO::FETCH_ASSOC);
	if( $total == 0 ) {
		header('location: logout.php');
		exit;
	}
}
?>

<section class="content-header">
	<div class="content-header-left">
		<h1>Edit Service</h1>
	</div>
	<div class="content-header-right">
		<a href="pincode.php" class="btn btn-primary btn-sm">View All</a>
	</div>
</section>

<?php
$statement = $pdo->prepare("SELECT * FROM pincode WHERE id=?");
$statement->execute(array($_REQUEST['id']));
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row) {
	$pincode = $row['pin_code'];
	$city = $row['city'];
	$service = $row['service'];
	$air = $row['air'];
	$road = $row['road'];
	$tat = $row['tat'];
	$areacode = $row['area_code'];
	$state=$row['state'];
}
?>

<section class="content">

	<div class="row">
		<div class="col-md-12">

			<?php if($error_message): ?>
			<div class="callout callout-danger">
				<p>
				<?php echo $error_message; ?>
				</p>
			</div>
			<?php endif; ?>

			<?php if($success_message): ?>
			<div class="callout callout-success">
				<p><?php echo $success_message; ?></p>
			</div>
			<?php endif; ?>

			<form class="form-horizontal" action="" method="post" enctype="multipart/form-data">
				<div class="box box-info">
					<div class="box-body">
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">PinCode <span>*</span></label>
							<div class="col-sm-6">
								<input type="text" autocomplete="off" class="form-control" name="pincode" value="<?php echo $pincode; ?>" readonly>
							</div>
						</div>
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">City <span>*</span></label>
							<div class="col-sm-6">
								<input type="text" class="form-control" name="city" value="<?php echo $city; ?>">
							</div>
						</div>	<div class="form-group">
							<label for="" class="col-sm-2 control-label">State <span>*</span></label>
							<div class="col-sm-6">
								<input type="text" class="form-control" name="state" value="<?php echo $state; ?>">
							</div>
						</div>	
						
						
						
							<div class="form-group">
							<label for="" class="col-sm-2 control-label">Service <span>*</span></label>
							<div class="col-sm-6">
							    <select class="form-control" name="service">
							         <option value="<?php echo $service;?>"><?php echo $service;?></option>
							        <option value="Yes">Yes</option>
							        <option value="No">No</option>
							    </select>
							</div>
						</div>
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">Air <span>*</span></label>
							<div class="col-sm-6">
							    <select class="form-control" name="air">
							         <option value="<?php echo $air;?>"><?php echo $air;?></option> 
							        <option value="Yes">Yes</option>
							        <option value="No">No</option>
							    </select>
							</div>
						</div>
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">Road <span>*</span></label>
							<div class="col-sm-6">
							    <select class="form-control" name="road">
							       <option value="<?php  echo $road;?>"><?php echo $road;?></option> 
							        <option value="Yes">Yes</option>
							        <option value="No">No</option>
							    </select>
							</div>
						</div>
					
						
						
						
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">TAT <span>*</span></label>
							<div class="col-sm-6">
								<input type="text" autocomplete="off" class="form-control" name="tat" value="<?php echo $tat; ?>">
							</div>
						</div>
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">Area Code <span>*</span></label>
							<div class="col-sm-6">
								<input type="text" autocomplete="off" class="form-control" name="areacode" value="<?php echo $areacode; ?>">
							</div>
						</div>
						
						
						
						<div class="form-group">
							<label for="" class="col-sm-2 control-label"></label>
							<div class="col-sm-6">
								<button type="submit" class="btn btn-success pull-left" name="form1">Submit</button>
							</div>
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>

</section>

<?php require_once('footer.php'); ?>

Zerion Mini Shell 1.0