make notification on php and jquery - javascript

<!DOCTYPE html>
<html>
<head>
<title><?php echo $title ?></title>
<!--Logo di title bar -->
<link rel="shortcut icon" href="<?php echo base_url();?>asset/img/logokominfo.png"/>
<!--CSS-->
<link rel="stylesheet" href="<?php echo base_url();?>asset/CSS/style-boots.css?<?php echo time(); ?>">
<link rel="stylesheet" href="<?php echo base_url();?>asset/CSS/style-pengumuman.css?<?php echo time(); ?>">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style type="text/css">
body {
background: #f7f7f7;
font-family: 'Montserrat', sans-serif;
}
.dropzone {
background: #fff;
border: 2px dashed #ddd;
border-radius: 5px;
}
.dz-message {
color: #999;
}
.dz-message:hover {
color: #464646;
}
.dz-message h3 {
font-size: 200%;
margin-bottom: 15px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="../asset/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="../asset/css/style-profile.css?<?php echo time(); ?>">
<script>
$('#tab4primary').click(function(){
<?php $notif= ''?>
});
</script>
</head>
<body>
<nav id="sticker" class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<a class="menu"><i class="fa fa-bars" id="menu_icon"></i></a>
<a class="navbar-brand" href="#">
<img src="<?php echo base_url();?>asset/img/logo_emagang.png" class="img-responsive" />
</a>
</div><!--navbar-header close-->
<div class="collapse navbar-collapse drop_menu" id="content_details">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<span class="glyphicon glyphicon-user"></span><?php echo $userData['nama_lengkap'] ?><span class="caret"></span>
<ul class="dropdown-menu">
<li><i class="fa fa-user" aria-hidden="true"></i> Profile
<li><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Ubah Profile</li>
<li><i class="fa fa-key" aria-hidden="true"></i> Ubah Password</li>
<li><i class="fa fa-sign-out" aria-hidden="true"></i> Logout
</li>
</ul>
</li>
</ul><!--navbar-right close-->
</div><!--collapse navbar-collapse drop_menu close-->
</div><!--container-fluid close-->
</nav><!--navbar navbar-inverse close-->
<br>
<br>
<section>
<div class="container" style="margin-top: 10px;">
<div class="profile-head">
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-12"><br><br><br><br><br><br>
<h6>
<img src="<?php echo base_url();?>uploads/images/<?php echo $userData['nama_foto']."?".time(); ?>">
<br><br><?php echo $userData['nama_lengkap'] ?><br><br>
</h6>
</div><!--col-md-4 col-sm-4 col-xs-12 close-->
<div class="col-md-8 col-sm-5 col-xs-12"><br><br><br><br><br>
<h5><?php echo $userData['nama_lengkap'] ?></h5>
<p>Siswa / Mahasiswa </p>
<ul>
<li><span class="glyphicon glyphicon-info-sign"></span> <?php echo $userData['tanggal_lahir'] ?></li>
<li><span class="glyphicon glyphicon-book"></span> <?php echo $userData['nama_institusi'] ?></li>
<li><span class="glyphicon glyphicon-home"></span> <?php echo $userData['alamat'] ?></li>
<li><span class="glyphicon glyphicon-phone"></span> <?php echo $userData['no_telpon'] ?></li>
<li><span class="glyphicon glyphicon-envelope"></span><?php echo $userData['email'] ?></li>
</ul>
</div><!--col-md-8 col-sm-8 col-xs-12 close-->
</div>
</div><!--profile-head close-->
</div><!--container close-->
<dir class="container">
<?php
// $id = $this->session->flashdata('id');
$salah = $this->session->flashdata('salah');
$berhasil = $this->session->flashdata('berhasil');
?>
<!--error message-->
<?php echo $salah['error'];?>
<?php echo $berhasil;?>
<?php
$status = $userData['status'];
if($status == 'diterima'){
$notif = 'baru';
}
?>
<div class="panel with-nav-tabs panel-primary">
<div class="panel-heading">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab1primary" data-toggle="tab">
<span class="glyphicon glyphicon-user"></span> Personal Data
</a></li>
<li><a href="#tab2primary" data-toggle="tab">
<i class="fa fa-university" aria-hidden="true"></i> Pendidikan
</a></li>
<li><a href="#tab3primary" data-toggle="tab">
<i class="fa fa-file" aria-hidden="true"></i> Daftar Riwayat Hidup
</a></li>
<li>
<a href="#tab4primary" data-toggle="tab">
<span class="badge quote-badge" id="pemberitahuan"><?php echo $notif ?></span>
<i class="fa fa-bullhorn" aria-hidden="true"></i> Pengumuman
</a></li>
</ul>
</div>
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane fade in active" id="tab1primary">
<div class="row">
<div class="col-md-8">
<table class="table table-striped">
<thead>
<tr>
<th>Data Akun</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Email</td>
<td>:</td>
<td>
<?php echo $userData['email'] ?>
</td>
</tr>
<tr>
<td>tanggal daftar</td>
<td>:</td>
<td>
<?php echo $userData['tanggal_daftar'] ?>
</td>
</tr>
</tbody>
<thead>
<tr>
<th>Tujuan Magang</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Satuan kerja</td>
<td>:</td>
<td>
<?php echo $userData['nama_satuan_kerja'] ?>
</td>
</tr>
<tr>
<td>Unit kerja</td>
<td>:</td>
<td>
<?php echo $userData['nama_unit_kerja'] ?>
</td>
</tr>
<tr>
<td>Tanggal Mulai</td>
<td>:</td>
<td>
<?php
$tanggal_mulai = $userData['tanggal_mulai'];
echo date('d F Y', strtotime($tanggal_mulai));
// $input = $userData['tanggal_mulai'];
// $date = strtotime($input);
// $day = date('d',$date);
// $month = date('m',$date);
// $year = date('Y',$date);
// echo $month;
?>
</td>
</tr>
<tr>
<td>Tanggal Selesai</td>
<td>:</td>
<td>
<?php
$tanggal_lahir = $userData['tanggal_selesai'];
echo date('d F Y', strtotime($tanggal_lahir));
?>
</td>
</tr>
</tbody>
<thead>
<tr>
<th>Data Pribadi</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Nama Lengkap</td>
<td>:</td>
<td>
<?php echo $userData['nama_lengkap'] ?>
</td>
</tr>
<tr>
<td>Jenis Kelamin</td>
<td>:</td>
<td>
<?php echo $userData['jenis_kelamin'] ?>
</td>
</tr>
<tr>
<td>Tanggal Lahir</td>
<td>:</td>
<td>
<?php
$tanggal_lahir = $userData['tanggal_lahir'];
echo date('d F Y', strtotime($tanggal_lahir));
?>
</td>
</tr>
<tr>
<td>Alamat</td>
<td>:</td>
<td>
<?php echo $userData['alamat'] ?>
</td>
</tr>
<tr>
<td>No telpon</td>
<td>:</td>
<td>
<?php echo $userData['no_telpon'] ?>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab2primary">
<table class="table table-striped">
<thead>
<tr>
<th>Pendidikan</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Tingkat Pendidikan</td>
<td>:</td>
<td>
<?php echo $userData['tingkat_pendidikan'] ?>
</td>
</tr>
<tr>
<td>Nama Institusi</td>
<td>:</td>
<td>
<?php echo $userData['nama_institusi'] ?>
</td>
</tr>
<tr>
<td>Jurusan</td>
<td>:</td>
<td>
<?php echo $userData['jurusan'] ?>
</td>
</tr>
<tr>
<td>Nilai Raport Rata-Rata/ IPK</td>
<td>:</td>
<td>
<?php echo $userData['nilai'] ?>
</td>
</tr>
<tr>
<td>Alamat Institusi</td>
<td>:</td>
<td>
<?php echo $userData['alamat_institusi'] ?>
</td>
</tr>
<tr>
<td>No telpon Institusi</td>
<td>:</td>
<td>
<?php echo $userData['no_telpon_institusi'] ?>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tab-pane fade" id="tab3primary">
<div class="row">
<div class="col-md-4">
<div class="alert alert-warning alert-dismissable fade in">
×
<strong>catatan :</strong> Untuk melihat CV langsung diprofile disarankan untuk menonaktifkan software bantuan download, seperti: IDM Dll.
</div>
<div class="bs-calltoaction bs-calltoaction-primary">
<div class="row">
<div class="col-md-12">
<p>Daftar Riwayat Hidup</p>
<div class="cta-button">
<span class="glyphicon glyphicon-download-alt"></span> Donwload daftar riwayat hidup
</div>
<p style="font-size: 12px">Terakhir Di Update : <?php
$tanggal_update_cv = $userData['tanggal_update_cv'];
echo date('d F Y', strtotime($tanggal_update_cv)); ?></p>
</div>
</div>
</div>
</div>
<div class="col-md-8">
<center>
<h4 class="name">Ubah CV / Daftar Riwayat Hidup</h4>
<hr class="whitehr">
</center>
<div id="content">
<div class="row">
<div class="col-md-7"><br>
<div class="dropzone">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<center><br><br><br><br>
<h3>Upload file disini</h3> ukuran <strong>maksimal</strong> 2MB
<?php echo form_open_multipart('users/updatecv');?>
<input type="hidden" id="id" name="id" value="<?php echo $userData['id'] ?>">
<input type="hidden" id="nama_cv" name="nama_cv" value="<?php echo $userData['nama_cv'] ?>">
<input type="file" style="margin-left : 50px" name="document" id="files" accept=".doc, .docx, application/msword, application/pdf" required>
<button style="margin-top : 20px" type="submit" value="Upload" name="submit" class="btn btn-primary btn-lg">
<i class="fa fa-upload" aria-hidden="true"></i>
upload
</button>
<?php echo form_close();?>
</center><br><br><br><br>
</div>
</div>
</div>
</div>
<div class="col-md-5">
Contoh CV(Daftar Riwayat Hidup)
<a href="<?php echo base_url();?>asset/doc/contoh_cv.doc">
<img src="<?php echo base_url();?>asset/doc/contoh_cv.png" style="width: 80%">
</a>
<div class="col-md-10">
<div class="cta-button">
Download Template CV
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab4primary">
<center>
<h1 class="name">Pengumuman</h1>
<hr class="whitehr">
</center>
<div class="col-sm-12 col-md-12 col-xm-12">
<div class="bs-calltoaction bs-calltoaction-warning">
<div class="row">
<div class="col-sm-2 col-md-3 col-xs-8">
<img src="<?php echo base_url();?>asset/img/alur-pendaftaran/6.png" class="img-responsive">
</div>
<div class="col-md-6 cta-contents">
<h3 class="cta-title">Waktu Magang Anda Telah Selesai</h3>
<hr>
<div class="cta-desc">
</div>
</div>
<div class="col-md-3 cta-button">
Download Sertifikat
</div>
</div>
</div>
<?php
$status = $userData['status'];
if($status == 'diterima'){
$this->load->view('dashboard/diterima');
}?>
<blockquote class="quote-box"><br>
<div class="col-sm-2 col-md-3 col-xs-8">
<img src="<?php echo base_url();?>asset/img/alur-pendaftaran/3.png" class="img-responsive">
</div>
<p class="quotation-mark">“</p>
<hr>
<div class="blog-post-actions">
<p class="blog-post-bottom pull-left">
Pengumuman
</p>
<p class="blog-post-bottom pull-right">
<span class="badge quote-badge">Biro Kepegawaian Dan Organisasi</span>
</p>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</dir>
<?php $this->load->view('footer');?>
</section><!--section close-->
<script type="text/javascript" src="../asset/js/jquery.min.js"></script>
<script type="text/javascript" src="../asset/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../asset/js/profile.js"></script>
<script type="text/javascript" src="../asset/js/pemberitahuan.js"></script>
</body>
</html>
i try to make notification with php when button notification i click or was clicked, the notification will be remove by jquery or js i made, but i get stack on there, how i can remove the notification when it was clicked.
here is the code i make for remove the notification
<script>
$('#tab4primary').click(function(){
<?php $notif= ''?>
});
</script>
and here code i made for show notification
<?php
$status = $userData['status'];//this i get from database
if($status == 'diterima'){
$notif = 'new';
}
?>
notification just text, so when $status == diterima it will be show new and when i click the button of notification and text new must be remove or gone but i got stock on there

As Berend de Groot suggested, you need to stay in JavaScript context once the page is loaded (and php stopped doing anything).
Try altering the HTML where the message is displayed directly :
<script>
$('#tab4primary').click(function(){
$('selectorWhereTheNotifTextIsWrittenInDOm').empty();
});
</script>
You may want to try to hide() instead of emptying depending on your DOM and the expected behavior.
EDIT : with the HTML you posted answer is now :
<script>
$('#tab4primary').click(function(){
$('#pemberitahuan').empty();
});
</script>
Same thing applies with hide() instead of empty()
EDIT 2 : Try :
<script>
$(document).ready(function() {
$('#tab4primary').click(function(){
$('#pemberitahuan').hide();
});
});
</script>
And make sure you remove :
<script>
$('#tab4primary').click(function(){
<?php $notif= ''?>
});
</script>
EDIT 3: #tab4primary does not seems to be the proper trigger element after all, if you try :
<script>
$('#pemberitahuan').click(function(){
$('#pemberitahuan').hide();
});
</script>
You should see something happening. It's now all a matter of selecting the proper trigger and target which should in most cases be different.

You can remove any element by jQuery remove function.
Please try the following code:
$('#tab4primary').click(function()
{
$('#tab4primary').remove();
});
or you can simply hide it using following code:
$('#tab4primary').click(function()
{
$('#tab4primary').hide();
});

Related

I have a business sales page that shows results from a json file. I want to be able to pass the information for one listing on a results page [duplicate]

This question already has answers here:
PHP Pass variable to next page
(9 answers)
Closed 1 year ago.
My index.php page has a display of listings from a json file which looks good. But I am trying to send a result of a single listing from that page to another page (result.php). How do I display the results of that single listing to the new page?
Here is the code for my first page that is attached to the json file:
<?php
$filename = file_get_contents("/ListingCollection.json");
$listings = json_decode($filename);
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<script src="https://kit.fontawesome.com/ac048d9955.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>
<div style="margin-left:150px; margin-right:150px; margin-bottom:150px;">
<?php foreach ($listings as $listing) { ?>
<span style="visibility:hidden;"><?= $listing->Oid; ?></span>
<div class="row align-items-center border-top">
<div class="col-3" style="padding:10px;">
<?= $listing->AdPhoto; ?>
</div>
<div class="row col-8" style="margin-left:10px;">
<div class="col-8 align-items-center">
<h2 style="color:#00471C; width: 700px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" type="button"><?= $listing->AdTitle; ?></h2>
<h3><?= $listing->AdTagLine; ?></h3>
<p><?= $listing->AdTagLine; ?></p>
</div>
<div class="col-4 align-items-start">
<center><h1><?= $listing->ListingPrice; ?></h1><h3>EBITDA: $<?= $listing->EBITDA; ?></h3></center><br><br>
<center><a class="btn btn-primary" href="<?= $listing->WebsiteURL; ?>?<?= $listing->Oid; ?>" role="button">See Listing</a></center>
</div>
</div>
</div>
<?php } ?>
</div>
</body>
</html>
Here is the code to my second page that I want to pull from single listing of index.php file:
<?php
require($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');
get_header();
$filename = file_get_contents("/ListingCollection.json");
$listings = json_decode($filename);
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<script src="https://kit.fontawesome.com/ac048d9955.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>
<div style="margin-left:150px; margin-right:150px; margin-top:50px; margin-bottom:50px;">
<?php foreach ($listings as $listing) { ?>
<!-- Ad Header -->
<div class="row align-items-center" style="margin-bottom:25px;">
<div class="col-12">
<h1><?= $listing->AdTitle; ?></h1>
<h3><?= $listing->County; ?>, <?= $listing->State; ?></h3>
</div>
</div>
<!-- Ad Photo -->
<div class="row" style="margin-bottom:25px;">
<div class="row col-8 align-items-center">
<div class="col-12">
<?= print "Your registration is: ".$regValue."."; ?>
<?= $listing->AdPhoto; ?><br><br>
</div>
<!-- Ad Pricing -->
<div class="col-6">
<h2>ASKING PRICE: $<?= $listing->ListingPrice; ?></h2>
</div>
<div class="col-6">
<h2>CASH FLOW: $<?= $listing->CashFlow; ?></h2>
</div>
<!-- Above button info -->
<div class="col-3">Gross Revenue: </div><div class="col-3">$<?= $listing->GrossRevenue; ?> </div><div class="col-3">Inventory: </div><div class="col-3">$<?= $listing->Inventory; ?></div>
<div class="col-3">EBITDA: </div><div class="col-3">$<?= $listing->EBITDA; ?> </div><div class="col-3">Rent: </div><div class="col-3">$<?= $listing->Rent; ?> </div>
<div class="col-3">FF&E: </div><div class="col-3">$<?= $listing->FFandE; ?> </div><div class="col-3">Established: </div><div class="col-3"><?= $listing->YearEstablished; ?> </div><br><br>
<!-- buttons -->
<div class="col-3">
<a class="btn btn-primary" style="width:100%;" type="button" href="">SAVE</a>
</div>
<div class="col-3">
<a class="btn btn-primary" style="width:100%;" type="button" href="">PRINT</a>
</div>
<div class="col-3">
<a class="btn btn-primary" style="width:100%;" type="button" href="">SHARE</a>
</div>
<div class="col-3">
<a class="btn btn-primary" style="width:100%;" type="button" href="">VALUATION REPORT</a>
</div>
<!-- Ad Description -->
<div class="col-12"><br><br><hr><br>
<h2>DESCRIPTION</h2>
<h2><?= $listing->AdTagLine; ?></h2>
<?= $listing->AdDescription ?><br>
<hr><br>
</div>
<!-- Ad Details -->
<div class="col-3">
<h3>Location:</h3>
</div>
<div class="col-9">
<?= $listing->County ?>
</div>
<div class="col-3">
<h3>Building SF:</h3>
</div>
<div class="col-9">
<?= $listing->TotalSqFt ?>
</div>
<div class="col-3">
<h3>Employees:</h3>
</div>
<div class="col-9">
<?= $listing->EmployeeCount ?>
</div>
<div class="col-3">
<h3>Facilities:</h3>
</div>
<div class="col-9">
<?= $listing->AdFacilityDescription ?>
</div>
<div class="col-3">
<h3>Competition:</h3>
</div>
<div class="col-9">
<?= $listing->AdCompetitiveAnalysis ?>
</div>
<div class="col-3">
<h3>Growth & Expansion:</h3>
</div>
<div class="col-9">
<?= $listing->AdOpportunityForGrowth ?>
</div>
<div class="col-3">
<h3>Support & Training:</h3>
</div>
<div class="col-9">
<?= $listing->AdSupportAndTraining ?>
</div>
<div class="col-3">
<h3>Reason for Selling:</h3>
</div>
<div class="col-9">
<?= $listing->AdReasonForSelling ?>
</div>
<div class="col-3">
<h3>Business Website:</h3>
</div>
<div class="col-9">
<?= $listing->WebsiteURL ?>
</div>
</div>
<div class="col-4 bg-light">
<div class="container">
<!-- CHANGE THE URL HERE -->
<div class="col-12">
<form action="https://app.99inbound.com/e/123" method="POST" target="_blank">
<h1 style="text-align: center;"><br>CONTACT US</h1>
<div class="form-group">
<input name="name" type="text" class="form-control" id="name" placeholder="Full Name" required>
<input name="phone" type="phone" class="form-control" id="phone" placeholder="Phone Number" required>
<input name="email" type="email" class="form-control" id="email" placeholder="Enter Email" required>
</div>
<div class="form-group">
<textarea name="message" class="form-control" id="message" rows="5" placeholder="Enter message" required></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<br><hr>
</div>
<div class="row col-12">
<div class="col-6"><p>Business Listed By:<br>
<?= $listing->SellerFirstName; ?> <?= $listing->SellerLastName; ?></p></div>
<div class="col-6"><p><i class="fas fa-phone-square-alt"></i> <?= $listing->SellerPhone; ?></div>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
<?php get_footer(); ?>
</body>
</html>
I might make a subtle change to the link to turn the ?id into a key/value pair, like
<center><a class="btn btn-primary" href="<?= $listing->WebsiteURL; ?>?display=<?= $listing->Oid; ?>" role="button">See Listing</a></center>
Then on the second page
<?php
require($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');
get_header();
$filename = file_get_contents("/ListingCollection.json");
$display = $_GET['display'];
$listings = json_decode($filename);
$listing=array_filter($listings, function($a) use($display) {
return $a->Oid === $display;
});
$listing = array_values($listing)[0];
// get rid of the loop on this page
// foreach ($listings as $listing) { <-- GONE
?>
<!-- then the rest of your code, using $listing -->
I fixed the problem by doing this to the button:
<?php echo"<a class='btn btn-primary' role='button' href='https://samplesite.com/result.php?" . http_build_query($listing) . "'>See Listing</a>"; ?>
Then echoing the items on the results page.

How to open Bootstrap modal by using a PHP GET request?

I search but I didn't find any solution for this. I need to create a modal like this.
When we pass true in GET request the modal must be shown. Otherwise if not any value for $GET request page will be load normally.
I am trying to do this by:
<?php if(isset($_GET["model"=="true"])){
echo "
<script type='text/javascript'>
$(document).ready(function(){
$('#addstudent').modal('show');
});
</script>" ;
} ?>
But it didn't work with my code.
Full code:
<?php
include_once('../func/islogin.php') ;
if($login=='false'){
header('location:../index.php');
}elseif($login!='true'){
header('location:../index.php');
}
include('../include/conn.php') ;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Creative - Bootstrap 3 Responsive Admin Template">
<meta name="author" content="GeeksLabs">
<link rel="shortcut icon" href="img/favicon.png">
<title>SMS - Sending System</title>
<script src="https://kit.fontawesome.com/e491dc23d1.js" crossorigin="anonymous"></script>
<link href="../css/bootstrap.min.css" rel="stylesheet">
<link href="../css/bootstrap-theme.css" rel="stylesheet">
<link href="../css/elegant-icons-style.css" rel="stylesheet"/>
<link href="../css/font-awesome.min.css" rel="stylesheet" />
<link href="../css/style.css" rel="stylesheet">
<link href="../css/style-responsive.css" rel="stylesheet" />
</head>
<body>
<?php if(isset($_GET["model"=="true"])){
echo "
<script type='text/javascript'>
$(document).ready(function(){
$('#addstudent').modal('show');
});
</script>" ;
} ?>
<section id="container" class="">
<header class="header dark-bg">
<div class="toggle-nav">
<div class="icon-reorder tooltips" data-original-title="Toggle Navigation" data-placement="bottom"><i class="icon_menu"></i></div>
</div>
SFT <span class="lite">හසිත පෙරේරා</span>
</div>
</header> <!--header menu end-->
<?php include('../include/design/slidebar.php') ?> <!--sidebar Include-->
</div>
</aside>
<section id="main-content">
<section class="wrapper">
<div class="row">
<div class="col-lg-12">
<h3 class="page-header"><i class="fas fa-chalkboard-teacher"></i> Classes</h3>
</div>
<?php include('../include/design/statusbar.php') ?>
</div>
<div class="row">
<div class="col-lg-8">
<section class="panel">
<header class="panel-heading text-center">
List Of All Classes
</header>
<table class="table table-striped table-advance table-hover">
<tbody>
<tr>
<th><i class="fas fa-sort-amount-down"></i></i> Class_ID</th>
<th><i class="fas fa-building"></i> Class_Name</th>
<th><i class="fas fa-sync-alt"></i></i> Status</th>
<th><i class="fas fa-user-edit"></i> Manage</th>
<th><i class="icon_cogs"></i> Action</th>
</tr>
<?php
$alldonators="SELECT * FROM classes ";
$alldonators_query = mysqli_query($conn,$alldonators);
if($alldonators_query){
while($row=mysqli_fetch_assoc($alldonators_query)){ ?>
<tr>
<td><?php echo $row['id'] ?></td>
<td><?php echo $row['Class'] ?></td>
<td>
<span
<?php if($row['isActive'] == 1){
echo " class='text-success'> <i class='icon_check_alt2'></i> Active ";
} else{
echo " class='text-danger' ><i class='fas fa-exclamation-circle'></i> Inactive";
}?>
</span>
</td>
<td><div class="btn btn-primary"><i class="fas fa-user-edit"></i> Manage Class</div></td>
<td><div class="btn-group">
<?php if($row['isActive'] == 1){
echo "<a class='btn btn-warning' href='#'><i class='fas fa-exclamation-circle'></i> </a>";
} else{
echo "<a class='btn btn-success' href='#'><i class='icon_check_alt2'></i> </a>";
}?>
<a class="btn btn-danger" href="#"><i class="icon_close_alt2"></i></a>
</div>
</td>
</tr>
<?php } } ?>
</tbody>
</table>
</section>
</div>
<div class="col-lg-4">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addstudent">
<i class="fas fa-plus-circle"></i> Create New Class
</button>
<div class="modal fade" id="addstudent" tabindex="-1" role="dialog" aria-labelledby="addstudents" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addstudent">Add Student-Class</h5>
</div>
<div class="modal-body">
<form action="../func/saveclass.php" method="POST">
<!-- Input Name -->
<div class="form-group">
<label for="ClassNameInput" required>Name For Class</label>
<textarea class="form-control" id="ClassNameInput" name="newclassInput" placeholder ="2020 A/L Matugame" rows="3" required></textarea>
</div>
<!-- input current Status -->
<div class="form-group">
<label for="InputCurrentStatus">Current Status</label>
<select class="form-control" id="InputCurrentStatus" name="statusInput">
<option value="1">Active</option>
<option value="0">Inactive</option>
</select>
</div>
</div>
<!-- modal-footer -->
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" name="saveClassBtn">Save changes</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</section>
</section>
<!-- container section end -->
<!-- javascripts -->
<script src="../js/jquery.js"></script>
<script src="../js/bootstrap.min.js"></script>
<!-- nice scroll -->
<script src="../js/jquery.scrollTo.min.js"></script>
<script src="../js/jquery.nicescroll.js" type="text/javascript"></script>
<!--custome script for all page-->
<script src="../js/scripts.js"></script>
</body>
</html>
It looks like your isset() statement is wrongly enclosed, you should have:
if (isset($_GET['model']) && $_GET['model'] === 'true')) {
// TODO
}
In short, your assertion needs to be separate to your check to make sure $_GET['model'] is set.
Instead of doing this, you could make a hidden input field and check for the GET parameters and then give it a value. Then in your jQuery check for the value of that input field and show the modal accordingly.
HTML
<input type="hidden" id="show_modal" value="<?php echo isset($_GET['model']) && $_GET['model'] === true ? 1 : 0; ?>
JQuery
$(document).ready(function(){
let show_modal = $('#show_modal').val();
if(show_modal == 1){
$('#addstudent').modal('show');
}
});

How to multiplying data from input to data in database using AJAX

I'm trying to multiply data from input (quantity) to data in the database (price) and show the result (total price) using AJAX
I expected when I change the quantity:
page automatically refresh and show the result (total price) of multiplying the quantity
data (total price) in the database too will be updated
What I got :
when I change data (quantity) page refreshed but data (quantity) will return to the previous value, and the result (total price) didn't change too
data (total price) not updated in database
When it fails, I try not using ajax and manually refresh the page but the result (total price) still not change, then I try to check in the console and see quantity data is changing but somehow it's not multiplying to (price) in data base
cart.php
<?php
session_start();
global $pid;
?>
<!--index.php-->
<!DOCTYPE html>
<html>
<head>
<title>Map Store</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://kit.fontawesome.com/fc847822ba.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="css/bootstrap.min.css" >
<link rel="stylesheet" type="text/css" href="fontawesome/css/all.min.css"/>
</head>
<body>
<nav class="navbar navbar-expand-md bg-dark navbar-dark">
<!-- Brand -->
<a class="navbar-brand" href="index.php">Map Store</a>
<!-- Toggler/collapsibe Button -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<!-- Navbar links -->
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link " href="index.php">Products</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Category</a>
</li>
<li class="nav-item">
<a class="nav-link" href="cart.php">Checkout</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="cart.php"><i class="fas fa-shopping-cart text-white"> <span id="cart-item" class="badge badge-danger"></span></i></a>
</li>
</ul>
</div>
</nav>
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-10">
<div style="display: <?php if(isset($_SESSION['showAlert'])){echo $_SESSION['showAlert'];} else {echo'none';} unset($_SESSION['showAlert']); ?>" class="alert alert-success alert-dismissible mt-3">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong><?php if(isset($_SESSION['message'])){echo $_SESSION['message'];} unset($_SESSION['showAlert']); ?></strong>
</div>
<div class="table-responsive mt-2">
<table class="table table-boarded table-stripped text-center">
<thead>
<tr>
<td colspan="7">
<h4 class="test-center text-info m-0"> Products in your cart</h4>
</td>
</tr>
<tr>
<th>ID</th>
<th>Image</th>
<th>Product</th>
<th>Price</th>
<th>Quantity</th>
<th>Total Price</th>
<th>
<i class="fas fa-trash"></i> Clear cart
</th>
</tr>
</thead>
<tbody>
<?php
require 'config.php';
$stmt = $conn->prepare("SELECT * FROM cart");
$stmt->execute();
$result = $stmt->get_result();
$grand_total = 0;
while($row = $result->fetch_assoc()):
?>
<tr>
<td type="hidden"><?= $row['id'] ?></td>
<input type="hidden" name="pid" class="pid" value="<?= $row['id'] ?>">
<td><img src="<?= $row['product_image'] ?>" width="50"> </td>
<td><?= $row['product_name']?></td>
<td><?= number_format ($row['product_price'],2); ?> </td>
<input type="hidden" name="pprice" class="pprice" value="<?= $row['product_price']?>" >
<td>
<input type="number" name="qty" min="1" class="form-control itemQty" value="<?= $row['qty'] ?>" style="width: 75px;"></td>
<td><?= number_format ($row['total_price'],2 ); ?></td>
<td>
<i class="fas fa-trash-alt"></i>
</td>
</tr>
<?php $grand_total +=$row['total_price']; ?>
<?php endwhile; ?>
<tr>
<td colspan="3">
<i class="fas fa-cart-plus"></i> Continue Shopping
</td>
<td colspan="2"><b>Grand Total :</b></td>
<td><?= number_format ($grand_total,2); ?></td>
<td>
<i class="far fa-credit-card"> </i>Checkout
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.slicknav.min.js"></script>
<script src="js/owl.carousel.min.js"></script>
<script src="js/jquery.nicescroll.min.js"></script>
<script src="js/jquery.zoom.min.js"></script>
<script src="js/jquery-ui.min.js"></script>
<script src="js/main.js"></script>
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- Popper JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$(".itemQty").on('change', function(){
var $el = $(this).closest('tr');
var pid = $el.find(".pid").val();
var pprice = $el.find(".pprice").val();
var qty = $el.find(".itemQty").val();
//console.log(qty);
location.reload(true);
$.ajax({
url : 'action_1.php',
method : 'post',
cache : false,
data : {qty:qty,pid:pid,pprice:pprice},
success : function(response){
console.log(response);
}
});
});
});
</script>
</body>
</html>
action_1.php
<!--action.php-->
<?php
session_start();
require 'config.php';
if(isset($_POST['qty'])) {
$qty = $_POST['qty'];
$pid = $_POST['id'];
$pprice = $_POST['pprice'];
$tprice = $qty*$pprice;
$stmt = $conn->prepare("UPDATE cart SET qty=?, total_price=? WHERE id=?");
$stmt->bind_param("isi",$qty,$tprice,$pid);
$stmt->execute();
}
if (isset($_POST['action']) && isset($_POST['action']) == 'order') {
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$products = $_POST['products'];
$grand_total = $_POST['grand_total'];
$address = $_POST['address'];
$pmode = $_POST['pmode'];
$data = '';
$stmt = $conn->prepare("INSERT INTO orders (name,email,phone,address,pmode,products,amount_paid) VALUES (?,?,?,?,?,?,?)");
$stmt->bind_param("sssssss",$name,$email,$phone,$address,$pmode,$products,$grand_total);
$stmt->execute();
$stmt = $conn->prepare("DELETE FROM cart");
$stmt->execute();
echo 'Thank You';
}
?>
I expected when I change the quantity:
1. page automatically refresh and show the result (total price) of multiplying the quantity
2. data (total price) in the database too will be updated
What I got :
1. when I change data (quantity) page refreshed but data (quantity) will return to the previous value and the result (total price) didn't change too
2. data (total price) not updated in database

passing a unique variable inbetween url

i have a software which passed a unique id to the url of my clients but limitation of my software is that is passes the unique id in the end of the url and sometimes link are too long and we want to pass id inbetween the url like www.zyx.com?id=i want to pass id here in between &jsabdkhbdf&sdkjbahdb&kjdsbkfbskdb&pid=jdndhf
i have seeen a software where is you to pass id in between you type like this ?id=[%id%] where every in url i type this parameter will pass there idk how its hapenning there pls help pasting the code
<?php require_once("session.php" );?>
<?php include("header.php"); require_once("dbcon.php");?>
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<li class="sidebar-search">
<div class="input-group custom-search-form">
<input type="text" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</li>
<li>
<i class="fa fa-dashboard fa-fw"></i> Dashboard<br>
</li>
<li>
<i class="fa fa-bar-chart-o fa-fw"></i> Survey<span class="fa arrow"></span>
<ul class="nav nav-second-level">
<li>
New Survey
Add Clients
Clients List
</li>
<li>
Survey List
</li>
</ul>
<!-- /.nav-second-level -->
</li><br>
<li>
<i class="fa fa-table fa-fw"></i>Add Vendor
Vendor List
</li>
<li>
<!-- /.nav-second-level -->
</li>
</ul>
</div>
<!-- /.sidebar-collapse -->
</div>
<!-- /.navbar-static-side -->
<nav>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-8 ">
<h1 class="page-header">Dashboard</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-3 col-md-6">
<div class="panel panel-primary">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-check-circle fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<?php
$sql = "SELECT COUNT(status) as count from new_survey WHERE Status LIKE 'open%'";
$result = $conn->query($sql);
while($rows = $result->fetch_assoc() )
echo "<div class='huge'>{$rows['count']}</div>";
?>
<div>Surveys Completed</div>
</div>
</div>
</div>
<a href="#">
<div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
<div class="col-lg-3 col-md-6">
<div class="panel panel-green">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-tasks fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge">New</div>
<div>Survey</div>
</div>
</div>
</div>
<a href="new_survey.php">
<div class="panel-footer">
<span class="pull-left">Create New Survey</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
<div class="col-lg-3 col-md-6">
<div class="panel panel-yellow">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-ban fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<?php
$sql = "SELECT COUNT(status) as count from new_survey WHERE Status LIKE 'close%'";
$result = $conn->query($sql);
while($rows = $result->fetch_assoc() )
echo "<div class='huge'>{$rows['count']}</div>";
?>
<div>InCompleted Surveys</div>
</div>
</div>
</div>
<a href="#">
<div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
<div class="col-lg-3 col-md-6">
<div class="panel panel-red">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-support fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<?php
$sql = "SELECT COUNT(status) as count from new_survey WHERE Status LIKE 'invoice%'";
$result = $conn->query($sql);
while($rows = $result->fetch_assoc() )
echo "<div class='huge'>{$rows['count']}</div>";
?>
<div>Invoiced Surveys</div>
</div>
</div>
</div>
<a href="#">
<div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
Survey List
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover" width="100%" border="1">
<thead><tr>
<th>Survey ID</th>
<th>Client Name</th>
<th>Survey Name</th>
<th>Client Live URL</th>
<th>Client Test URL</th>
<th>Completed</th>
<th>InCompleted</th>
<th>Quota Full</th>
<th>Time Period</th>
<th>Creation Date</th>
<th>End Date</th>
<th>Status</th>
<th>Edit</th>
</tr>
</thead>
<tbody>
<?php
**this is unique parameter**
**$a = bin2hex(random_bytes(10));**
$sql = "SELECT * from new_survey where survey_id order by survey_id desc";
$result = $conn->query($sql);
while($rows = $result->fetch_assoc() ){
echo "<tr>";
echo " <td>{$rows['survey_id']}</td>";
echo " <td>{$rows['client_name']}</td>";
echo "<td>{$rows['survey_name']}</td>";
here it is passing when fetching the url from database onclick of link
**echo "<td> <a href=". $rows['client_live_url'] . urlencode($a) . "&s_id=" . $rows['survey_id'] . " target='_blank'> Click Here </a></td>";**
echo "<td> Click Here </td>";
echo" <td>{$rows['completed']}</td>";
echo "<td>{$rows['incompleted']}</td>";
echo "<td>{$rows['quota_full']}</td>";
echo" <td>{$rows['time_period']}</td>";
echo" <td>{$rows['creation_date']}</td>";
echo" <td>{$rows['end_date']}</td>";
echo" <td>{$rows['status']}</td>";
echo" <td><a href=\"edit_survey.php?id={$rows['survey_id']}\">Edit</td>";
echo "</tr>";
}
$conn->close();
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- /#page-wrapper -->
<div class="panel-footer">
<div class="text-center">
<?php echo date('Y'); ?>, ©
<?php echo "$copyright"; ?>
</div>
</div>
<!-- /#wrapper -->
<!-- jQuery -->
<script src="./vendor/jquery/jquery.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="./vendor/bootstrap/js/bootstrap.min.js"></script>
<!-- Metis Menu Plugin JavaScript -->
<script src="./vendor/metisMenu/metisMenu.min.js"></script>
<!-- Morris Charts JavaScript -->
<script src="./vendor/raphael/raphael.min.js"></script>
<script src="./vendor/morrisjs/morris.min.js"></script>
<script src="./data/morris-data.js"></script>
<!-- Custom Theme JavaScript -->
<script src="./dist/js/sb-admin-2.js"></script>

the click event is not working after pagination.so the 11th record cant be approve/delete by admin .we are using ace admin template

Here is the ajax code:
<script type="text/javascript">
if('ontouchstart' in document.documentElement) document.write("<script src='assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
</script>
<script src="assets/js/bootstrap.min.js"></script>
<!-- page specific plugin scripts -->
<script src="assets/js/jquery.dataTables.min.js"></script>
<script src="assets/js/jquery.dataTables.bootstrap.min.js"></script>
<!-- ace scripts -->
<script src="assets/js/ace-elements.min.js"></script>
<script src="assets/js/ace.min.js"></script>
<!-- inline scripts related to this page -->
<script type="text/javascript">
$(document).ready(function(){
$("#simple-table").DataTable();
$(".viewrecord").click(function(e){
e.preventDefault();
$.ajax({
url:"processes.php",
type: "post",
async: false,
data:{action:"view_image_info",post_id:$(this).attr('id')},
success:function(res){
$(".page-content .row .col-xs-12").html('');
$(".page-content .row .col-xs-12").html(res);
$(".page-content").append('<div class="row"><div class="col-xs-12"><button type="button" id="backbutton" class="width-10 btn btn-sm btn-primary"><i class="ace-icon glyphicon glyphicon-chevron-left"></i><span class="bigger-110">Back</span></button></div></div>');
}
});
});
$(".deleterecord").click(function(e){
e.preventDefault();
$.ajax({
url:"processes.php",
type: "post",
async: false,
data:{action:"delete_image",post_id:$(this).attr('id')},
success:function(res){
if(res == 'success'){
alert("Image deleted successfully");
window.location.reload();
} else {
alert("Some error occured while deleting the image");
window.location.reload();
}
}
});
});
$(".approvevideo").click(function(e){
e.preventDefault();
$.ajax({
url:"processes.php",
type: "post",
async: false,
data:{action:"approve_image",post_id:$(this).attr('id')},
success:function(res){
if(res == 'success'){
alert("Image approved");
window.location.reload();
} else {
alert("Some error occured while approving the image");
window.location.reload();
}
}
});
});
$(".page-content").on('click','#backbutton', function(){
window.location.reload();
});
});
</script>
Here is the PHP code:
<?php
#$total_count_query = mysql_query("SELECT COUNT(post_id) as totalrows FROM `yoga_posts` WHERE `post_type`='image' ");
$totalrows=0;
while($row = mysql_fetch_array($total_count_query)){
$totalrows = $row['totalrows'];
}
if($totalrows==0){
?>
<tr>
<td colspan="4">No Records Found</td>
</tr>
<?php
} else {
#$query = mysql_query("SELECT * FROM `yoga_posts` WHERE `post_type`='image' ");
while($row = mysql_fetch_array($query)){
?>
<tr>
<td class="center">
<label class="pos-rel">
<input type="checkbox" class="ace" />
<span class="lbl"></span>
</label>
</td>
<td><?php echo $row['post_title'];?></td>
<td><?php echo get_username_from_id($row['user_id']);?></td>
<td>
<div class="action-buttons">
<a class="blue viewrecord" href="#" id="<?php echo $row['post_id'];?>">
<i class="ace-icon fa fa-search-plus bigger-130"></i>
</a>
<a class="red deleterecord" href="#" id="<?php echo $row['post_id'];?>">
<i class="ace-icon fa fa-trash-o bigger-130"></i>
</a>
<?php if($row['post_status']=='pending'){?>
<a class="green approvevideo" href="#" id="<?php echo $row['post_id'];?>">
<i class="ace-icon ace-icon glyphicon glyphicon-ok bigger-130"></i>
</a>
<?php } ?>
<?php
#$total_count_query = mysql_query("SELECT COUNT(post_id) as totalrows FROM `yoga_posts` WHERE `post_type`='image' ");
$totalrows=0;
while($row = mysql_fetch_array($total_count_query)){
$totalrows = $row['totalrows'];
}
if($totalrows==0){
?>
<tr>
<td colspan="4">No Records Found</td>
</tr>
<?php
} else {
#$query = mysql_query("SELECT * FROM `yoga_posts` WHERE `post_type`='image' ");
while($row = mysql_fetch_array($query)){
?>
<tr>
<td class="center">
<label class="pos-rel">
<input type="checkbox" class="ace" />
<span class="lbl"></span>
</label>
</td>
<td><?php echo $row['post_title'];?></td>
<td><?php echo get_username_from_id($row['user_id']);?></td>
<td>
<div class="action-buttons">
<a class="blue viewrecord" href="#" id="<?php echo $row['post_id'];?>">
<i class="ace-icon fa fa-search-plus bigger-130"></i>
</a>
<a class="red deleterecord" href="#" id="<?php echo $row['post_id'];?>">
<i class="ace-icon fa fa-trash-o bigger-130"></i>
</a>
<?php if($row['post_status']=='pending'){?>
<a class="green approvevideo" href="#" id="<?php echo $row['post_id'];?>">
<i class="ace-icon ace-icon glyphicon glyphicon-ok bigger-130"></i>
</a>
<?php } ?>
<?php
#$total_count_query = mysql_query("SELECT COUNT(post_id) as totalrows FROM `yoga_posts` WHERE `post_type`='image' ");
$totalrows=0;
while($row = mysql_fetch_array($total_count_query)){
$totalrows = $row['totalrows'];
}
if($totalrows==0){
?>
<tr>
<td colspan="4">No Records Found</td>
</tr>
<?php
} else {
#$query = mysql_query("SELECT * FROM `yoga_posts` WHERE `post_type`='image' ");
while($row = mysql_fetch_array($query)){
?>
<tr>
<td class="center">
<label class="pos-rel">
<input type="checkbox" class="ace" />
<span class="lbl"></span>
</label>
</td>
<td><?php echo $row['post_title'];?></td>
<td><?php echo get_username_from_id($row['user_id']);?></td>
<td>
<div class="action-buttons">
<a class="blue viewrecord" href="#" id="<?php echo $row['post_id'];?>">
<i class="ace-icon fa fa-search-plus bigger-130"></i>
</a>
<a class="red deleterecord" href="#" id="<?php echo $row['post_id'];?>">
<i class="ace-icon fa fa-trash-o bigger-130"></i>
</a>
<?php if($row['post_status']=='pending'){?>
<a class="green approvevideo" href="#" id="<?php echo $row['post_id'];?>">
<i class="ace-icon ace-icon glyphicon glyphicon-ok bigger-130"></i>
</a>
<?php } ?>
<?php
#$total_count_query = mysql_query("SELECT COUNT(post_id) as totalrows FROM `yoga_posts` WHERE `post_type`='image' ");
$totalrows=0;
while($row = mysql_fetch_array($total_count_query)){
$totalrows = $row['totalrows'];
}
if($totalrows==0){
?>
<tr>
<td colspan="4">No Records Found</td>
</tr>
<?php
} else {
#$query = mysql_query("SELECT * FROM `yoga_posts` WHERE `post_type`='image' ");
while($row = mysql_fetch_array($query)){
?>
<tr>
<td class="center">
<label class="pos-rel">
<input type="checkbox" class="ace" />
<span class="lbl"></span>
</label>
</td>
<td><?php echo $row['post_title'];?></td>
<td><?php echo get_username_from_id($row['user_id']);?></td>
<td>
<div class="action-buttons">
<a class="blue viewrecord" href="#" id="<?php echo $row['post_id'];?>">
<i class="ace-icon fa fa-search-plus bigger-130"></i>
</a>
<a class="red deleterecord" href="#" id="<?php echo $row['post_id'];?>">
<i class="ace-icon fa fa-trash-o bigger-130"></i>
</a>
<?php if($row['post_status']=='pending'){?>
<a class="green approvevideo" href="#" id="<?php echo $row['post_id'];?>">
<i class="ace-icon ace-icon glyphicon glyphicon-ok bigger-130"></i>
</a>
<?php } ?>

Categories

Resources