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/dp-code-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['dp_code'])) {
		$valid = 0;
		$error_message .= 'Dp Code can not be empty<br>';
	}
		if(empty($_POST['area_code'])) {
		$valid = 0;
		$error_message .= 'Area code can not be empty<br>';
	}
		if(empty($_POST['distict'])) {
		$valid = 0;
		$error_message .= 'distict 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 dp_code SET pincode=?, dp_code=?,area_code=?, distict=? WHERE id=?");
    		$statement->execute(array($_POST['pincode'],$_POST['dp_code'],$_POST['area_code'],$_POST['distict'],$_REQUEST['id']));

	    $success_message = 'Dp Cide 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 dp_code 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">
		<h4>Edit Dp Code Details</h4>
	</div>
	<div class="content-header-right">
		<a href="dp-code.php" class="btn btn-primary btn-sm">View All</a>
	</div>
</section>

<?php
$statement = $pdo->prepare("SELECT * FROM dp_code WHERE id=?");
$statement->execute(array($_REQUEST['id']));
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
?>

<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">
				<select class="form-control select2" name="pincode" id="pincode">
							<?php	$statement = $pdo->prepare("SELECT * FROM pincode ORDER BY id ASC");
			$statement->execute();
			$result = $statement->fetchAll(PDO::FETCH_ASSOC);	
			foreach ($result as $row) {
				?>
				<option value="<?php echo $row['pin_code']; ?>" <?php if($results[0]['pincode']==$row['pin_code']){ echo "selected";} ?>><?php echo $row['pin_code']; ?>-<?php echo $row['area_code']; ?>-<?php echo $row['city']; ?></option>
				<?php
			} ?>
			</select>
							</div>
						</div>
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">Dp Code <span>*</span></label>
							<div class="col-sm-6">
								<input type="text" autocomplete="off" class="form-control" name="dp_code" value="<?php if(isset($results[0]['dp_code'])){echo $results[0]['dp_code'];} ?>">
							</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="area_code" value="<?php if(isset($results[0]['area_code'])){echo $results[0]['area_code'];} ?>">
							</div>
						</div>
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">District <span>*</span></label>
							<div class="col-sm-6">
								<input type="text" autocomplete="off" class="form-control" name="distict" value="<?php if(isset($results[0]['distict'])){echo $results[0]['distict'];} ?>">
							</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