Last active
November 8, 2017 09:27
-
-
Save HelloAlberuni/8b5713be1170239c08ef to your computer and use it in GitHub Desktop.
new user add for hgapp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php include 'config.php'; ?> | |
<?php | |
if (isset($_POST['form_referer_add'])) { | |
try{ | |
$refer_name = $_POST['refer_name']; | |
if (empty($refer_name)) { | |
throw new Exception("Referance name can't be empty"); | |
} | |
$statement = $db->prepare("INSERT INTO tbl_reference (referer) VALUES (?)"); | |
$statement->execute(array($refer_name)); | |
$success_msg = "Data successfully inserterd"; | |
} | |
catch(Exception $e){ | |
$error_msg = $e->getMessage(); | |
} | |
} | |
?> | |
<?php include 'header.php'; ?> | |
<?php include 'sidebar.php'; ?> | |
<div class="content-wrapper"> | |
<!-- Content Header (Page header) --> | |
<section class="content-header"> | |
<h1> | |
Refarence Add | |
</h1> | |
<ol class="breadcrumb"> | |
<li><a href="#"><i class="fa fa-dashboard"></i> Refarence</a></li> | |
<li class="active">Here</li> | |
</ol> | |
</section> | |
<!-- Main content --> | |
<section class="content content_add_new_domain_package"> | |
<div class="row"> | |
<div class="col-xs-6"> | |
<div class="box box-<?php | |
if(isset($success_msg)){ | |
echo 'success'; | |
}elseif(isset($error_msg)){ | |
echo 'danger'; | |
}else{ | |
echo 'info'; | |
} | |
?>"> | |
<div class="box-header with-border"> | |
<?php | |
if(isset($success_msg)){ | |
echo '<h3 class="box-title" style="color:#00a65a">'.$success_msg.'</h3>'; | |
} | |
elseif(isset($error_msg)){ | |
echo '<h3 class="box-title" style="color:#dd4b39">'.$error_msg.'</h3>'; | |
} | |
else{ | |
echo '<h3 class="box-title">Refarence Add</h3>'; | |
} | |
?> | |
</div> | |
<form name="form_referer_add" method="POST" action="" class="form-horizontal"> | |
<div class="box-body"> | |
<div class="form-group"> | |
<label for="" class="col-sm-4">Refarence Name</label> | |
<div class="col-sm-8"><input class="" type="text" name="refer_name" id=""></div> | |
</div> | |
</div> | |
<div class="box-footer"> | |
<button type="submit" name="form_referer_add" class="btn btn-primary">Add</button> | |
</div> | |
</form> | |
</div> | |
</div> | |
<div class="col-xs-6"> | |
<div class="box box-info"> | |
<div class="box-header with-border">Refarence List</div> | |
<div class="box-body"> | |
<table id="example2" class="table table-bordered table-hover dataTable" role="grid" aria-describedby="example2_info"> | |
<thead> | |
<tr> | |
<th>Refarence Name</th> | |
<th>Action</th> | |
</tr> | |
</thead> | |
<tbody> | |
<?php | |
$statement = $db->prepare('SELECT * FROM tbl_reference'); | |
$statement->execute(); | |
$results = $statement->fetchAll(); | |
foreach ($results as $row) { | |
?> | |
<tr> | |
<td><?php echo $row['referer']; ?></td> | |
<td> | |
<a title="Edit informations" href=""><i class="fa fa-eyedropper"></i></a> <b>|</b> | |
<a title="Delete This" href=""><i class="fa fa-times"></i></a> | |
</td> | |
</tr> | |
<?php } ?> | |
</tbody> | |
</table> | |
</div> | |
</div> | |
</div> | |
</div><!-- /.row --> | |
</section><!-- /.content --> | |
</div><!-- /.content-wrapper --> | |
<?php include 'footer.php'; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment