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/logistic-edit.php

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

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

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

	if(empty($_POST['short_name'])) {
		$valid = 0;
		$error_message .= 'Short Name can not be empty<br>';
	}
		if(empty($_POST['status'])) {
		$valid = 0;
		$error_message .= 'Status 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 tbl_logistic SET name=?, short_name=?,status=? WHERE id=?");
    		$statement->execute(array($_POST['name'],$_POST['short_name'],$_POST['status'],$_REQUEST['id']));

	    $success_message = 'Logistic 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 tbl_logistic 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="row">
    	<div class="col-md-2" style="text-align: right;">
		    <a href="logistics.php" class="btn btn-danger btn-sm"><i class="fa fa-arrow-left"></i> Back to Logistic List</a>
		</div>
		<div class="col-md-4" style="text-align: center;">
			<h4><i class="fa fa-info-circle"></i> Update Logistics Details</h4>
		</div>
	
	</div>
</section>



<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>
					<div class="box-body">
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">Name <span>*</span></label>
							<div class="col-sm-6">
								<input type="text" autocomplete="off" class="form-control" name="name" value="<?php echo $result[0]['name']; ?>" >
							</div>
						</div>
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">Short Name <span>*</span></label>
							<div class="col-sm-6">
								<input type="text" class="form-control" name="short_name" value="<?php echo $result[0]['short_name']; ?>">
							</div>
						</div>
					    <div class="form-group">
							<label for="" class="col-sm-2 control-label">Status <span>*</span></label>
							<div class="col-sm-6">
							    <select class="form-control" name="status">
							        <option value="1" <?php if($result[0]['status']==1){ echo "selected";} ?>>Active</option>
							        <option value="0" <?php if($result[0]['status']==0){ echo "selected";} ?>>In-active</option>
							    </select>
							</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