File "testimonial.php"
Full Path: /home/jaipuriiht/public_html/admin/testimonial.php
File size: 8.55 KB
MIME-type: text/x-php
Charset: utf-8
<?php include("includes/header.php"); ?>
<?php
if($_POST['a']=='EditTesti'){
if($_POST['adsnl_image']!=''){
$image = "image = '".str_replace(',','',$_POST['adsnl_image'])."',";
}
$sql = "UPDATE testimonial SET fullName = '".$_POST['fullname']."', ".($_POST['adsnl_image']==''?'':$image)." designation = '".$_POST['designation']."', company = '".$_POST['company']."', Message = '".$_POST['Message']."' WHERE id = '".$_POST['ID']."'";
mysqli_query($connmysql, $sql);
echo '<script>window.location="https://www.jaipuriiht.com/admin/testimonial.php"</script>';
}
if($_POST['a']=='AddTesti'){
$sql = "INSERT INTO testimonial(fullName, image, designation, company, Message, Added) VALUES ('".$_POST['fullname']."', '".str_replace(",","",$_POST['adsnl_image'])."', '".$_POST['designation']."', '".$_POST['company']."', '".$_POST['Message']."', '".time()."')";
mysqli_query($connmysql, $sql);
echo '<script>window.location="https://www.jaipuriiht.com/admin/testimonial.php"</script>';
}
if($_GET['a']=='DeleteTesti'){
$sql = "DELETE FROM testimonial WHERE id = '".$_GET['id']."'";
mysqli_query($connmysql, $sql);
echo '<script>window.location="https://www.jaipuriiht.com/admin/testimonial.php"</script>';
}
?>
<!-- ============================================================== -->
<!-- Page wrapper -->
<!-- ============================================================== -->
<div class="page-wrapper">
<!-- ============================================================== -->
<!-- Container fluid -->
<!-- ============================================================== -->
<div class="container-fluid">
<!-- ============================================================== -->
<!-- Bread crumb and right sidebar toggle -->
<!-- ============================================================== -->
<div class="row page-titles">
<div class="col-md-5 align-self-center">
<h4 class="text-themecolor">Testimonials</h4>
</div>
</div>
<!-- ============================================================== -->
<!-- End Bread crumb and right sidebar toggle -->
<!-- ============================================================== -->
<div class="row">
<div class="col-md-6">
<div class="card card-body">
<h3 class="box-title m-b-0">Add New</h3>
<p class="text-muted m-b-30 font-13"> </p>
<div class="row">
<div class="col-sm-12 col-xs-12">
<form method="post" action="">
<input type="hidden" name="a" value="AddTesti">
<div class="form-group">
<label for="fullname">Full Name</label>
<input type="text" name="fullname" class="form-control" id="fullname" placeholder="Enter Full Name">
</div>
<div class="form-group">
<label>Image</label>
<div class="clearfix"></div>
<input id="adsnl_image" type="hidden" value="" name="adsnl_image">
<input id="addimg" type="button" class="btn label-default" onClick="javascript:openDialogue();" value="Add Image" name="addimg">
<table id="files">
</table>
</div>
<div class="form-group">
<label for="company">Company</label>
<input type="text" name="company" class="form-control" id="company" placeholder="Company">
</div>
<div class="form-group">
<label for="designation">Designation</label>
<input type="text" name="designation" class="form-control" id="designation" placeholder="Designation">
</div>
<div class="form-group">
<label for="Message">Message</label>
<textarea id="Message" name="Message" class="form-control"></textarea>
</div>
<input type="submit" class="btn btn-success waves-effect waves-light m-r-10" value="Save">
</form>
</div>
</div>
</div>
</div>
<div class="col-6">
<div class="card">
<div class="card-body">
<h4 class="card-title">Testimonial List</h4>
<h6 class="card-subtitle"> </h6>
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Company</th>
<th>Designation</th>
<th class="text-nowrap">Action</th>
</tr>
</thead>
<tbody>
<?php
$Sql = "SELECT id, fullName, image, designation, company FROM testimonial ORDER BY id DESC";
$Res = mysqli_query($connmysql, $Sql);
while($Row = mysqli_fetch_array($Res)){
?>
<tr>
<td><?php echo '<img src="images/'.$Row['image'].'" width="148px" height="148px">';?><p><?php echo $Row['fullName']?></p></td>
<td><?php echo $Row['company']; ?></td>
<td><?php echo $Row['designation']; ?></td>
<td class="text-nowrap">
<a href="#myModalEdit" data-toggle="modal" data-original-title="Edit" data-id="<?php echo $Row['id'];?>"> <i class="fa fa-pencil text-inverse m-r-10"></i> </a>
<a href="#" onclick="DeleteTesti(<?php echo $Row['id']; ?>)" data-toggle="tooltip" data-original-title="Close"> <i class="fa fa-close text-danger"></i> </a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<!-- sample modal content -->
<div id="myModalEdit" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Edit Testimonial</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body fetched-data">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger waves-effect text-left" data-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</div>
</div>
</div>
</div>
</div>
</div>
<!-- ============================================================== -->
<!-- End Container fluid -->
<!-- ============================================================== -->
</div>
<!-- ============================================================== -->
<!-- End Page wrapper -->
<!-- ============================================================== -->
<?php include("includes/footer.php");?>