Sweet Alert to $_POST - mysql

I want to update data using php/mysql but beeing a new programmer in PHP.
I am wondering how I could:
1- Use an application form with Sweet Alert so that in my CRUD when I may click on 'Edit', and instead of being redirected to process replacing it with one easy step?
2- Send data coming from this completed form when I click on a button in the PHP's $_POST superglobal so that I'd be able to test the data and update my database.
Can someone help me please? Here is my code from crud.php:
<?php
session_start(); // on a besoin des variables de session
include_once("inc/inc_header.php");
include_once("inc/inc_nav.php");
include_once('connection.php');
include_once('oldconnection.php');
//include_once('../dist/libs/grocery-crud-1.5.8.1/application/libraries/Grocery_CRUD.php');
//include_once('../dist/libs/grocery-crud-1.5.8.1/application/libraries/image_moo.php');
?>
<?php
if(isset($_GET['oneDeleted']) && $_GET['oneDeleted'] == true && isset($_GET['stopUser']))
{
?>
<h2>
<?php
extract($_GET);
echo $stopUser." a bien ete supprime. ";
?>
</h2>
<?php
}
?>
<?php
// on recupere les donnees d'obis.
$cruder = $con->prepare("SELECT * FROM user");
$cruder->execute();
$abonnes = $cruder->fetchAll(); // on met ses donnees personnelles dans $mesInfos, elles serviront en placeholder.
foreach($abonnes as $abonne)
{
$keepId = $abonne['user_id'];
?>
<?php /*if(isset($_GET['oneDeleted'] && $_GET['oneDeleted'] == true) && isset($_GET['stopuser']))
{ ?>
<h2>
<?php
extract($_GET);
echo $stopUser." a bien ete supprime.";
?>
</h2>
<?php }*/ ?>
<br />
<table class="table table-hover table-inverse">
<thead>
<tr>
<th>user_id</th>
<th>Nom</th>
<th>Prenom</th>
<th>Email</th>
<th>Telephone</th>
<th>Statut</th>
<th>Nombre de reservations</th>
<th>Derniere visite</th>
<th>Derniere reservation</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $abonne['user_id']; ?></td>
<td><?php echo $abonne['nom']; ?></td>
<td><?php echo $abonne['prenom']; ?></td>
<td><?php echo $abonne['email']; ?></td>
<td><?php echo $abonne['tel']; ?></td>
<td>
<?php
$status = $abonne['rights'];
if($status == 1)
{
echo "Admin";
}else
{
echo "Visiteur";
}
?>
</td>
<td><?php echo $abonne['last_visit']; ?></td>
<td><?php echo $abonne['nb_reservation']; ?></td>
<td><?php echo $abonne['event_id']; ?></td>
<td>
<a>
<button type="button" class="btn btn-outline-warning" data-toggle="modal" data-target="#editUserModal">
Editer
</button>
</a>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<button type="button" class="btn btn-outline-danger btn-outline-warning"
onclick="swal({
title: 'AVERTISSEMENT!',
text: 'CET UTILISATEUR SERA DEFINITIVEMENT SUPPRIME !',
type: 'warning',
showCancelButton: true,
cancelButtonText: 'ANNULER',
confirmButtonColor: '#DD6B55',
confirmButtonText: 'OUI, je le supprime.',
closeOnConfirm: false
},
function(){
timer: 5000;
document.location.href='deleteUser.php?user_id=<?php echo $keepId; ?>';
});
"
>
Supprimer
</button>
</td>
</tr>
</tbody>
</table>
<?php
}
include_once("inc/inc_footer.php");
?>

Related

Echo output table data with paging from mysql through ajax into div modal bootstrap [ solved ]

now im creating a small quiz web app connecting to mysql db, everything goes well..
till have a problem to deal with create table inside modal pop up..
when i put the whole table inside div class="modal-body", its show on main page ( behind the modal ) not inside the modal.
since the problem that i faced above, im using diffrent approach to create a table, after doing reasearc on entire web forum, there is another way to create table without table tag, its said we can use div to create the table. it does and work well. the table show up inside modal with some data from database.
now it seem ive seen heaven door a head , but the pagination have block me up, i tried some code but its still no luck, since i go with div table i cant use instant table like datatable because its lack of node ( Non-table node initiation ) neither with traditional way url path.
all ineed is show one question per page with naviigate links ( prev | next )
Any assistance you can provide would be greatly appreciated
Below is the screenshoot the apps after user log in then it allow the user to choose which quiz they ready for
and this one how its look after user choosed the quiz provide
as we can see at the picture above , how can i colaborate with paging that can deal with div table ?
below is some code from quiz.php
<div class="table-container clearfix">
<table id="tableInvoicesList" class="table table-list hidden">
<thead>
<tr>
<th>Upload Modul</th>
<th>Modul</th>
<th>Peserta</th>
<th>Dibuat</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php
$sql = $koneksi->query("select * from quiz_list where to_list='$_SESSION[tipe]' order by id_list desc");
while($data=$sql->fetch_assoc()){
?>
<tr>
<td><?php echo date("d-m-Y",strtotime($data['cr_list'])); ?></td>
<td><?php echo $data['nm_list']; ?></td>
<td><?php echo $data['to_list']; ?></td>
<td><?php echo $data['by_list']; ?></td>
<td>
<!--
Mulai Quiz
-->
<!-- Button trigger modal -->
<a data-toggle="modal" data-id="<?php echo $data['kd_list'];?>" class="passingID">
<button type="button"
class="btn btn-primary btn-sm"
data-toggle="modal"
data-target="#showquiz<?php echo $data['kd_list'];?>">
<i class="fas fa-pencil-alt"></i> Quiz
</button>
</a>
</td>
</tr>
<!-- Modal -->
<div class="modal fade"
id="showquiz<?php echo $data['kd_list'];?>"
data-keyboard="false"
data-backdrop="static"
tabindex="-1"
role="dialog"
aria-labelledby="exampleModalCenterTitle"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle"><?php echo $data['nm_list']; ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<!--
<input type="text" class="form-control" name="idkl" id="idkl" value="">
-->
<style type="text/css">
.divTable
{
display: table;
width:auto;
background-color:#eee;
border:1px solid #666666;
border-spacing:5px;/*cellspacing:poor IE support for this*/
/* border-collapse:separate;*/
}
.divRow
{
display:table-row;
width:auto;
}
.divCell
{
float:left;/*fix for buggy browsers*/
display: table-cell;
width:555px;
background-color:#ccc;
}
</style>
<?php
$batas = 1;
$halaman = #$_GET['halaman'];
if(empty($halaman)){
$posisi = 0;
$halaman = 1;
}
else{
$posisi = ($halaman-1) * $batas;
}
$no = $posisi+1;
$result = $koneksi->query("select * from bank_soal where kd_list= '$data[kd_list]';");
while($tampil = $result->fetch_assoc()){
?>
<div class="divTable" id="page<?php echo $no; ?>">
<div class="headRow">
<div class="divCell"><?php echo $tampil['soal']; ?></div>
</div>
<div class="divRow">
<div class="divCell">001</div>
</div>
<div class="divRow">
<div class="divCell">xxx</div>
</div>
<div class="divRow">
<div class="divCell">ttt</div>
</div>
<div class="divRow">
<div class="divCell">ttt</div>
</div>
</div>
<?php $no++; } ?>
<hr>
<?php
$query2 = $koneksi->query("select * from bank_soal where kd_list='$data[kd_list]';");
$jmldata = mysqli_num_rows($query2);
$jmlhalaman = ceil($jmldata/$batas);
?>
<div class="text-center">
<ul class="pagination">
<?php
for($i=1;$i<=$jmlhalaman;$i++) {
if ($i != $halaman) {
echo "<li class='page-item'><a class='page-link' href='index.php?halaman=$i'>$i</a></li>";
} else {
echo "<li class='page-item active'><a class='page-link' href='#'>$i</a></li>";
}
}
?>
</ul>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<script>
function showPages(id){
var totalNumberOfPages = 1;
for(var i=1; i<=totalNumberOfPages; i++){
if (document.getElementById('page'+i)) {
document.getElementById('page'+i).style.display='none';
}
}
if (document.getElementById('page'+id)) {
document.getElementById('page'+id).style.display='block';
}
};
</script>
<script>
$(document).on("click", ".passingID", function () {
var ids = $(this).attr('data-id');
$(".modal-body #idkl").val( ids );
});
</script>
<?php } ?>
</tbody>
</table>
<div class="text-center" id="tableLoading">
<p><i class="fas fa-spinner fa-spin"></i> Sedang memuat...</p>
</div>
after tried some other way,i found the solution for viewing data table inside modal problem,
so back to first plan, im keep using table tag to create the table, but not inside the modal body.
i create another file for ajax function to pass data from database and presenting the result within table and send it to div with id selector, for future reference , let me to share this piece of ajax code
main_modal.php
<!-- Modal -->
<div id="dataModal" class="modal fade" data-keyboard="false" data-backdrop="static"> <!--id dataModal wajib -->
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><?php echo $data['nm_list'];?></h5>
<button type="button" class="close" data-dismiss="modal"> ×</button>
</div>
<div class="modal-body" id="quiz_detail">
<!--Awal Modal Body-->
<!--Akhir Modal Body-->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$('.view_quiz').click(function(){
var quiz_id = $(this).attr("id");
$.ajax({
url:"page/quiz/view_quiz.php",
method:"post",
data:{quiz_id:quiz_id},
success:function(data){
$('#quiz_detail').html(data);
$('#dataModal').modal("show");
}
});
});
});
</script>
and for the paging , im using bootstrap datatable
<?php
if(isset($_POST["quiz_id"]))
{
$output = '';
$connect = new mysqli("localhost","root","","k3177986_admintugumulyo");
$query ="select * from bank_soal where kd_list= '".$_POST["quiz_id"]."'";
$result = $connect->query($query);
$jumlah = mysqli_num_rows($result);
$no = 0;
$output .='
<div class ="table-responsive col-md-12">
<table id="example" class="table table-bordered">
<thead>
<tr>
<th bgcolor="navy"><font size="2" face="verdana" color="white">SOAL</font></th>
</tr>
</thead>
<tbody>';
while($row = $result->fetch_assoc())
{
$no++;
$output .='
<form id="exampleForm" name="example" role="form">
<input type="hidden" name="id[]" value="'.$row["id_soal"].'">
<input type="hidden" name="jumlah" value="'.$jumlah.'">
<tr>
<td bgcolor="goldenrod">
<p><b>
'.$row["soal"].'
</b></p>
<p>
<input type="radio" id="" name="pilihan['.$row["id_soal"].']" value="a">
<label for="">'.$row["a"].'</label><br/>
</p>
<p>
<input type="radio" id="" name="pilihan['.$row["id_soal"].']" value="b">
<label for="">'.$row["b"].'</label><br/>
</p>
<p>
<input type="radio" id="" name="pilihan['.$row["id_soal"].']" value="c">
<label for="">'.$row["c"].'</label><br/>
</p>
<p>
<input type="radio" id="" name="pilihan['.$row["id_soal"].']" value="d">
<label for="">'.$row["d"].'</label><br/>
</p>
<input type="hidden" id="" name="jawaban['.$row["id_soal"].']" value="'.$row["x"].'">
</td>
</tr>
</form>
';
}
$output .='</tbody></thead></table></div>';
$output .='
<script>
$(document).ready(function() {
$("#example").DataTable({
"bInfo":false,
"lengthChange": false,
searching: false,
"targets": "no-sort",
"bSort": false,
"order": [],
"pageLength": 1
});
} );
</script>
';
echo $output;
}
?>

How to remove vertical bar from print preview

I am trying to print a bootstrap modal in chrome but I see always I press the print button and preview the print, the preview shows this vertical bar.
How can I remove this vertical bar in print preview. I don't know why this is showing. There is no vertical bar in the actual bootstrap modal which I am printing.
Any help is appreciated. Thanks
Here is the html coding:
<style>
.str td{
padding-top:1px !important;
padding-bottom:1px !important;
}
.table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td{padding: 5px;}
</style>
<div class="modal-dialog modal-lg no-modal-header">
<div class="modal-content">
<div class="modal-body">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
<i class="fa fa-2x">×</i>
</button>
<button type="button" class="btn btn-xs btn-default no-print pull-right" style="margin-right:15px;" onclick="window.print();">
<i class="fa fa-print"></i> <?= lang('print'); ?></button>
<?php if ($logo) {
?>
<div class="text-cente no-print" style="margin-bottom:20px;">
<img src="<?= base_url() . 'assets/uploads/logos/' . $biller->logo; ?>"
alt="<?= $biller->company && $biller->company != '-' ? $biller->company : $biller->name; ?>">
</div>
<?php
} ?>
<div class="well well-sm no-print">
<div class="row bold">
<div class="col-xs-5">
<p class="bold">
<?= lang('date'); ?>: <?= $this->sma->hrld($inv->date); ?><br>
<?= lang('ref'); ?>: <?= $inv->reference_no; ?><br>
<?php if (!empty($inv->return_sale_ref)) {
echo lang('return_ref') . ': ' . $inv->return_sale_ref;
if ($inv->return_id) {
echo ' <a data-target="#myModal2" data-toggle="modal" href="' . admin_url('sales/modal_view/' . $inv->return_id) . '"><i class="fa fa-external-link no-print"></i></a><br>';
} else {
echo '<br>';
}
} ?>
<?= lang('sale_status'); ?>: <?= lang($inv->sale_status); ?><br>
<?= lang('payment_status'); ?>: <?= lang($inv->payment_status); ?><br>
<?= $inv->payment_method ? lang('payment_method') . ': ' . lang($inv->payment_method) : ''; ?>
<?php
if ($inv->payment_method == 'cod' || $inv->payment_method == 'bank' && $inv->attachment) {
?>
<a href="<?= admin_url('welcome/download/' . $inv->attachment) ?>"
title="<?= lang('attachment') ?>" class="tip">
<i class="fa fa-chain"></i>
</a>
<?php
}
?>
<?php if ($inv->payment_status != 'paid' && $inv->due_date) {
echo '<br>' . lang('due_date') . ': ' . $this->sma->hrsd($inv->due_date);
} ?>
</p>
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
</div>
<div class="row" style="margin-bottom:15px;">
<?php if ($Settings->invoice_view == 1) {
?>
<div class="col-xs-12 text-center">
<h1><?= lang('tax_invoice'); ?></h1>
</div>
<?php
} ?>
</div>
<?php
$col = $Settings->indian_gst ? 5 : 4;
if ($Settings->product_discount && $inv->product_discount != 0) {
$col++;
}
if ($Settings->tax1 && $inv->product_tax > 0) {
$col++;
}
if ($Settings->product_discount && $inv->product_discount != 0 && $Settings->tax1 && $inv->product_tax > 0) {
$tcol = $col - 2;
} elseif ($Settings->product_discount && $inv->product_discount != 0) {
$tcol = $col - 1;
} elseif ($Settings->tax1 && $inv->product_tax > 0) {
$tcol = $col - 1;
} else {
$tcol = $col;
}
?>
<div class="row" style="margin-bottom:10px;">
<?php if ($Settings->invoice_view == 1) {
?>
<div class="col-xs-12 text-center">
<h1><?= lang('tax_invoice'); ?></h1>
</div>
<?php
} ?>
<div class="col-xs-4">
<div class="row">
<div class="col-xs-2" style="padding-right: 0px;">
<?php echo $this->lang->line('to'); ?>:
</div>
<div class="col-xs-10 pull-left" style="padding-left: 10px;">
<strong>
<p><small><?= $customer->company && $customer->company != '-' ? $customer->company : $customer->name; ?></small></p>
<?= $customer->company && $customer->company != '-' ? '' : 'Attn: ' . $customer->name ?></strong></p>
</strong>
</div>
<div class="col-xs-10" style="padding-right: 0px;">
<small>
<?php if ($customer->vat_no != '-' && $customer->vat_no != '') {
echo '<br>' . lang('vat_no') . ': ' . $customer->vat_no;
}
if ($customer->gst_no != '-' && $customer->gst_no != '') {
echo '<br>' . lang('gst_no') . ': ' . $customer->gst_no;
}
if ($customer->cf1 != '-' && $customer->cf1 != '') {
echo lang('ccf1') . ': ' . $customer->cf1;
}
if ($customer->cf2 != '-' && $customer->cf2 != '') {
echo '<br>' . lang('ccf2') . ': ' . $customer->cf2;
}
if ($customer->cf3 != '-' && $customer->cf3 != '') {
echo '<br>' . lang('ccf3') . ': ' . $customer->cf3;
}
if ($customer->cf4 != '-' && $customer->cf4 != '') {
echo '<br>' . lang('ccf4') . ': ' . $customer->cf4;
}
if ($customer->cf5 != '-' && $customer->cf5 != '') {
echo '<br>' . lang('ccf5') . ': ' . $customer->cf5;
}
if ($customer->cf6 != '-' && $customer->cf6 != '') {
echo '<br>' . lang('ccf6') . ': ' . $customer->cf6;
}
?>
</small>
</div>
</div>
</div>
<div class="col-xs-4">
<?php
echo '<small>'.$customer->address . '<br>' . $customer->city . ' ' . $customer->postal_code . ' ' . $customer->state . '<br>' . $customer->country;
?>
</div>
<div class="col-xs-4">
<small><?php echo lang('tel') . ': ' . $customer->phone . '<br>' . lang('email') . ': ' . $customer->email;
?></small>
</div>
</div>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped print-table order-table" style="page-break-inside:auto">
<tbody>
<tr>
<th colspan="2"><small>SALES PERSON</small></th>
<th colspan="2"><small>REFERENCE NO</small></th>
<th colspan="2"><small>INVOICE DATE</small></th>
<th colspan="2"><small>PAID BY</small></th>
</tr>
<tr>
<td colspan="2"><small><?=$created_by->first_name?></small></td>
<td colspan="2"><small><?=$inv->reference_no?></small></td>
<td colspan="2"><small><?=$this->sma->hrld($inv->date)?></small></td>
<td colspan="2"><small><?=$payments?></small></td>
</tr>
<tr>
<th><small>NO</small></th>
<th><small>DESCRIPTION</small></th>
<th><small>QTY</small></th>
<th><small>UNIT</small></th>
<th><small>SUB TOTAL</small></th>
<th><small>%</small></th>
<th class="text-right"><small>TOTAL</small></th>
</tr>
<?php $r = 1;
if($rows){
foreach ($rows as $row):
?>
<tr class="str" style="<?php if($r == 9){ echo 'page-break-inside:avoid; page-break-after:auto;'; } ?>" >
<td class="std"><small><?=$r?></small></td>
<td class="std"><small><?=$row->product_name?></small></td>
<td class="std"><small><?=$this->sma->formatQuantity($row->unit_quantity)?></small></td>
<td class="std"><small><?=number_format((float)$row->unit_price + $row->item_discount, 2, '.', '')?></small>
</td>
<td class="std"><small><?=number_format((float)($row->unit_price)*($row->unit_quantity), 2, '.', '')?></small>
</td>
<td class="std"><small><?=number_format((float)$row->item_discount, 2, '.', '')?></small></td>
<td class="text-right"><small><?=$this->sma->formatMoney($row->subtotal)?></small></td>
</tr>
<?php
$r++;
endforeach;
}
if ($return_rows) {
echo '<tr class="warning"><td colspan="100%" class="no-border"><strong>' . lang('returned_items') . '</strong></td></tr>';
foreach ($return_rows as $row):
?>
<tr>
<td><small><?=$r?></small></td>
<td><small><?=$row->product_name?></small></td>
<td><small><?=$this->sma->formatQuantity($row->unit_quantity)?></small></td>
<td><small><?=number_format((float)$row->unit_price + $row->item_discount, 2, '.', '')?></small>
</td>
<td><small><?=number_format((float)($row->unit_price)*($row->unit_quantity), 2, '.', '')?></small>
</td>
<td><small><?=number_format((float)$row->item_discount, 2, '.', '')?></small></td>
<td class="text-right"><small><?=$this->sma->formatMoney($row->subtotal)?></small></td>
</tr>
<?php
$r++;
endforeach;
}
?>
</tbody>
<tfoot>
<tr>
<th colspan="6" class="text-right"><small><?=lang('total');?></small></th>
<th colspan="2" class="text-right">
<small><?=$this->sma->formatMoney($return_sale ? (($inv->total + $inv->product_tax) + ($return_sale->total + $return_sale->product_tax)) : ($inv->total + $inv->product_tax));?></small>
</th>
</tr>
<?php
if ($inv->order_tax != 0) {
echo '<tr><th colspan="6><small>' . lang('tax') . '</th><th class="text-right"colspan="2"><small>' . $this->sma->formatMoney($return_sale ? ($inv->order_tax + $return_sale->order_tax) : $inv->order_tax) . '</small></th></tr>';
}
if ($inv->order_discount != 0) {
echo '<tr><th colspan="6" class="text-right"><small>' . lang('order_discount') . '</small></th><th class="text-right" colspan="2"><small>' . $this->sma->formatMoney($return_sale ? ($inv->order_discount + $return_sale->order_discount) : $inv->order_discount) . '</small></th></tr>';
}
if ($inv->shipping != 0) {
echo '<tr><th colspan="6" class="text-right"><small>' . lang('shipping') . '</th><th class="text-right" colspan="2"><small>' . $this->sma->formatMoney($inv->shipping) . '</small></th></tr>';
}
if ($return_sale) {
if ($return_sale->surcharge != 0) {
echo '<tr><th colspan="6" class="text-right"><small>' . lang('return_surcharge') . '</small></th><th class="text-right" colspan="2"><small>' . $this->sma->formatMoney($return_sale->surcharge) . '</small></th></tr>';
}
}
if ($Settings->indian_gst) {
if ($inv->cgst > 0) {
$cgst = $return_sale ? $inv->cgst + $return_sale->cgst : $inv->cgst;
echo '<tr><td colspan="6"><small>' . lang('cgst') . '</small></td><td class="text-right" colspan="2"><small>' . ($Settings->format_gst ? $this->sma->formatMoney($cgst) : $cgst) . '</small></td></tr>';
}
if ($inv->sgst > 0) {
$sgst = $return_sale ? $inv->sgst + $return_sale->sgst : $inv->sgst;
echo '<tr><td colspan="6"><small>' . lang('sgst') . '</small></td><td class="text-right" colspan="2"><small>' . ($Settings->format_gst ? $this->sma->formatMoney($sgst) : $sgst) . '</small></td></tr>';
}
if ($inv->igst > 0) {
$igst = $return_sale ? $inv->igst + $return_sale->igst : $inv->igst;
echo '<tr><td colspan="6"><small>' . lang('igst') . '</small></td><td class="text-right" colspan="6"><small>' . ($Settings->format_gst ? $this->sma->formatMoney($igst) : $igst) . '</small></td></tr>';
}
}
if ($pos_settings->rounding || $inv->rounding != 0) {
?>
<tr>
<th colspan="6" class="text-right"><small><?=lang('rounding'); ?></small></th>
<th colspan="2" class="text-right">
<small><?= $this->sma->formatMoney($inv->rounding); ?></small></th>
</tr>
<tr>
<th colspan="6" class="text-right"><small><?=lang('grand_total'); ?></small></th>
<th colspan="2" class="text-right">
<small><?=$this->sma->formatMoney($return_sale ? (($inv->grand_total + $inv->rounding) + $return_sale->grand_total) : ($inv->grand_total + $inv->rounding)); ?></small>
</th>
</tr>
<?php
} else {
?>
<tr>
<th colspan="6" class="text-right"><small><?=lang('grand_total'); ?></small></th>
<th colspan="2" class="text-right">
<small><?=$this->sma->formatMoney($return_sale ? ($inv->grand_total + $return_sale->grand_total) : $inv->grand_total); ?></small>
</th>
</tr>
<?php
}
if ($inv->paid < ($inv->grand_total + $inv->rounding)) {
?>
<tr>
<th colspan="6" class="text-right"><small><?=lang('paid_amount'); ?></small></th>
<th colspan="2" class="text-right">
<small><?=$this->sma->formatMoney($return_sale ? ($inv->paid + $return_sale->paid) : $inv->paid); ?></small>
</th>
</tr>
<tr>
<th colspan="6" class="text-right"><small>Due Amount</small></th>
<th colspan="2" class="text-right">
<small><?=$this->sma->formatMoney(($return_sale ? (($inv->grand_total + $inv->rounding) + $return_sale->grand_total) : ($inv->grand_total + $inv->rounding)) - ($return_sale ? ($inv->paid + $return_sale->paid) : $inv->paid)); ?></small>
</th>
</tr>
<?php
} ?>
<td colspan='8'>
<strong><small>Please Note : Any deposit balances are due prior to the above Confirmed
Product Delivery Date</small></strong>
<br>
<small>All goods remain the property of Arcadia Traders untill paid in full.</small>
<br>
<small>- Please use invoice number as reference for all payments.</small>
</td>
</tr>
</tfoot>
</table>
</div>
<?= $Settings->invoice_view > 0 ? $this->gst->summary($rows, $return_rows, ($return_sale ? $inv->product_tax + $return_sale->product_tax : $inv->product_tax)) : ''; ?>
<div class="row">
<div class="col-xs-12">
<?php
if ($inv->note || $inv->note != '') {
?>
<div class="well well-sm">
<p class="bold"><?= lang('note'); ?>:</p>
<div><?= $this->sma->decode_html($inv->note); ?></div>
</div>
<?php
}
if ($inv->staff_note || $inv->staff_note != '') {
?>
<div class="well well-sm staff_note">
<p class="bold"><?= lang('staff_note'); ?>:</p>
<div><?= $this->sma->decode_html($inv->staff_note); ?></div>
</div>
<?php
} ?>
</div>
<?php if ($customer->award_points != 0 && $Settings->each_spent > 0) {
?>
<div class="col-xs-5 pull-left">
<div class="well well-sm">
<?=
'<p>' . lang('this_sale') . ': ' . floor(($inv->grand_total / $Settings->each_spent) * $Settings->ca_point)
. '<br>' .
lang('total') . ' ' . lang('award_points') . ': ' . $customer->award_points . '</p>'; ?>
</div>
</div>
<?php
} ?>
<div class="order_barcodes no-print">
<table class="table">
<tbody>
<tr>
<td>
<div style="max-width:200px; padding-top:7px;">
<img src="<?= admin_url('misc/barcode/' . $this->sma->base64url_encode($inv->reference_no) . '/code128/74/0/1'); ?>"
alt="<?= $inv->reference_no; ?>" class="bcimg">
</div>
</td>
<td class="text-right">
<div style="max-width:70px">
<?= $this->sma->qrcode('link', urlencode(admin_url('sales/view/' . $inv->id)), 2); ?>
</div>
</td>
</tr>
</tbody>
</table>
<br>
</div>
<div class="col-xs-5 pull-right no-print">
<div class="well well-sm">
<p>
<?= lang('created_by'); ?>:
<?= $inv->created_by ? $created_by->first_name . ' ' . $created_by->last_name : $customer->name; ?>
<br>
<?= lang('date'); ?>: <?= $this->sma->hrld($inv->date); ?>
</p>
<?php if ($inv->updated_by) {
?>
<p>
<?= lang('updated_by'); ?>:
<?= $updated_by->first_name . ' ' . $updated_by->last_name; ?><br>
<?= lang('update_at'); ?>: <?= $this->sma->hrld($inv->updated_at); ?>
</p>
<?php
} ?>
</div>
</div>
</div>
<?php if (!$Supplier || !$Customer) {
?>
<div class="buttons">
<div class="btn-group btn-group-justified">
<div class="btn-group">
<a href="<?= admin_url('sales/add_payment/' . $inv->id) ?>" class="tip btn btn-primary"
title="<?= lang('add_payment') ?>" data-toggle="modal" data-target="#myModal2">
<i class="fa fa-dollar"></i>
<span class="hidden-sm hidden-xs"><?= lang('payment') ?></span>
</a>
</div>
<div class="btn-group">
<a href="<?= admin_url('sales/add_delivery/' . $inv->id) ?>" class="tip btn btn-primary"
title="<?= lang('add_delivery') ?>" data-toggle="modal" data-target="#myModal2">
<i class="fa fa-truck"></i>
<span class="hidden-sm hidden-xs"><?= lang('delivery') ?></span>
</a>
</div>
<?php if ($inv->attachment) {
?>
<div class="btn-group">
<a href="<?= admin_url('welcome/download/' . $inv->attachment) ?>" class="tip btn btn-primary"
title="<?= lang('attachment') ?>">
<i class="fa fa-chain"></i>
<span class="hidden-sm hidden-xs"><?= lang('attachment') ?></span>
</a>
</div>
<?php
} ?>
<div class="btn-group">
<a href="<?= admin_url('sales/email/' . $inv->id) ?>" data-toggle="modal"
data-target="#myModal2" class="tip btn btn-primary" title="<?= lang('email') ?>">
<i class="fa fa-envelope-o"></i>
<span class="hidden-sm hidden-xs"><?= lang('email') ?></span>
</a>
</div>
<div class="btn-group">
<a href="<?= admin_url('sales/pdf/' . $inv->id) ?>" class="tip btn btn-primary"
title="<?= lang('download_pdf') ?>">
<i class="fa fa-download"></i>
<span class="hidden-sm hidden-xs"><?= lang('pdf') ?></span>
</a>
</div>
<?php if (!$inv->sale_id) {
?>
<div class="btn-group">
<a href="<?= admin_url('sales/edit/' . $inv->id) ?>" class="tip btn btn-warning sledit"
title="<?= lang('edit') ?>">
<i class="fa fa-edit"></i>
<span class="hidden-sm hidden-xs"><?= lang('edit') ?></span>
</a>
</div>
<div class="btn-group">
<a href="#" class="tip btn btn-danger bpo"
title="<b><?= $this->lang->line('delete_sale') ?></b>"
data-content="<div style='width:150px;'><p><?= lang('r_u_sure') ?></p><a class='btn btn-danger' href='<?= admin_url('sales/delete/' . $inv->id) ?>'><?= lang('i_m_sure') ?></a> <button class='btn bpo-close'><?= lang('no') ?></button></div>"
data-html="true" data-placement="top">
<i class="fa fa-trash-o"></i>
<span class="hidden-sm hidden-xs"><?= lang('delete') ?></span>
</a>
</div>
<?php
} ?>
</div>
</div>
<?php
} ?>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('.tip').tooltip();
});
</script>
I'm no sure of what exactly your problem is, but you can try adding style="overflow: hidden;" at the beginning (at str) and maybe that solves the problem.
You can simply hide this scroll bar by adding this css property in your style tag only if your website do not have scrolling behaviour
html { overflow: hidden; }
But if you website does have scrolling behaviour and you just want to remove this scroll bar from printing document then you can use add these css proeprties in your style tag
::-webkit-scrollbar {
width: 0px;
background: transparent;
/* make scrollbar transparent */
actual answer
Try using window.print() and hide everything except the modal. The scroll bars won’t be there using this method.

display table values in view depending on id in codeigniter

I have one view candidate details form in my application.
In that I gave one button called scheduled interview.
So when I click on the button it redirect the page to candidate process page with the candidate_id and user_id in the url.
And in the candidate_process page I have one form with some details and under the form I display all the records from database in data table.
I want to display the records only for the particular candidate.I don't want to display all the records.
Here is my view:
<form method="post" action="" id="form">
<b>Date </b>:<input type="text" name="date" id="date"><br><br>
<input type="hidden" name="candidate_id" value="<?php echo $getCandidate['candidate_id']; ?>">
<input type="hidden" name="user_id" value="<?php echo $getCandidate['user_id']; ?>">
<div class="form-group">
<label><b>Select Interview Type:</b></label>
<select class="form-control" id="interview_type_id" name="interview_type_id" >
<option value="" disabled selected>Interview Type</option>
<?php foreach($interviewtype as $rows) { ?>
<option value="<?php echo $rows->interview_type_id?>"><?php echo ucfirst($rows->interview_type_name)?></option>
<?php } ?>
</select>
</div><br>
<div class="form-group">
<label><b>Select Status:</b></label>
<select class="form-control" id="status_type_id" name="status_type_id" >
<option value="" disabled selected>Status Type</option>
<?php foreach($statustype as $rows) { ?>
<option value="<?php echo $rows->status_type_id?>"><?php echo ucfirst($rows->status)?></option>
<?php } ?>
</select>
</div><br>
<button type="submit" name="submit" value="submit" class="btn btn-primary" value="submit">Submit</button>
<button type="submit" id="submit" name="submit" class="btn btn-primary" value="schedule" onclick="ScheduleNextRound();">Schedule Next Round</button><br></br>
</form>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h3>Reports</h3>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-body">
<table id="example1" class="table table-bordered table-hover">
<thead>
<tr>
<th>Interview Date</th>
<th>Candidate</th>
<th>interview</th>
<th>status</th>
<th>Vendor</th>
</tr>
</thead>
<?php foreach ($view_candidates as $idata){ ?>
<tbody>
<tr id="domain<?php echo $idata->candidate_seletion_id;?>">
<td><?php echo $idata->date;?></td>
<td><?php echo $idata->f_name;?></td>
<td><?php echo $idata->interview_type_name;?></td>
<td><?php echo $idata->status;?></td>
<td><?php echo $idata->first_name;?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
</div>
</section>
</div>
Controller:
function candidate_process($candidateid,$userid){
$data["msg"]="";
$this->load->model('CandidateModel');
$data['statustype']=$this->CandidateModel->getstatustypes();
$data['interviewtype']=$this->CandidateModel->getinterviewtypes();
$data['candidate']=$this->CandidateModel->getcandidates();
$data['usertype']=$this->CandidateModel->getvendors();
$data['getCandidate'] = $this->CandidateModel->get_candidate_detail($candidateid);
$data['view_candidates'] = $this->CandidateModel->getcandidateselection();//this is my table view
if($this->input->post('submit')=="submit"){
$this->CandidateModel->add_candidate_selection($this->input->post());
redirect(base_url('Candidate/view_candidate_selection'));
}
$this->load->view('Candidates/candidate_process',$data);
}
Model1:
public function add_candidate_selection($data){
$data=array(
'candidate_id'=>$this->input->post('candidate_id'),
'user_id'=>$this->input->post('user_id'),
'status_type_id'=>$this->input->post('status_type_id'),
'interview_type_id'=>$this->input->post('interview_type_id'),
'date'=>$this->input->post('date')
);
$this->db->insert('candidate_selection', $data);
//print_r($data);
}
MOdel2:
public function getcandidateselection(){
$this->db->select('*');
$this->db->from('candidate_selection');
$this->db- >join('candidates_details','candidates_details.candidate_id=candidate_selection.candidate_id');
$this->db->join('interview_types','interview_types.interview_type_id=candidate_selection.interview_type_id');
$this->db->join('status_types','status_types.status_type_id=candidate_selection.status_type_id');
$this->db->join('users','users.user_id=candidate_selection.user_id');
$query = $this->db->get();
//echo $this->db->last_query();
return $query->result();
}
Can anyone help me how to do this..
Thanks in advance.
Replace the Following code in your model function
function getcandidateselection($candidateid)
{
$this->db->join('candidate_selection as cs','cs.candidate_id = cd.candidate_id');
$this->db->join('status_types as st','st.status_type_id = cs.status_type_id');
$this->db->where('cd.candidate_id',$candidateid);
$q = $this->db->get('candidates_details as cd');
return $q->result();
}
Hope it will solve your problem

wrong size of bootstrap dropdown. not responsive how to fix?

I wonder how I can change the size of bootstrap select tag. It is not responsive as well. Please see attachment, in first picture there is small resolution in second one is bigger.
<div class="col-md-9">
<?php $this->load->view('FlashMessagesView'); ?>
<div class="col-md-12 form-group">
<?php if ($searchTerm)
{ ?>
<h3>Vysledky hladania:
<a href="<?php echo base_url('Product/index/') . $subCategoryId; ?>" style="cursor: pointer; color: red"
class="glyphicon glyphicon-remove" aria-hidden="true"></a>
</h3>
<?php } ?>
<div class="col-md-3" style="float: right">
<?php echo form_open('Product/index/' . $subCategoryId,
['id' => 'form_search', 'class' => 'form-horizontal', 'role' => 'form']); ?>
<div class="input-group">
<input type="hidden" name="subcategory_id"
value="<?php echo $subCategoryId ?>"/>
<input type="text" class="form-control" name="product_description"
placeholder="Hladat velkost RAM, CPU...">
<span class="input-group-btn"><button class="btn btn-default" type="submit"><span
class="glyphicon glyphicon-search"></span></button></span>
<?php echo form_close(); ?>
</div>
</div>
Cena: <span class="glyphicon glyphicon-arrow-down" style="cursor: pointer"
onclick="sortProductByLowestPrice()"></span><span class="glyphicon glyphicon-arrow-up"
style="cursor: pointer"
onclick="sortProductByHighestPrice()"></span><br>
Len skladom <input type="checkbox" id="stock_sort" name="stock_only" onclick="sortProductByStock()">
</div>
<?php
$con = mysqli_connect('localhost', 'root', '');
mysqli_select_db($con, 'test');
$sql = "SELECT * FROM products WHERE subcategory_id = " . $subCategoryId;
$result = mysqli_query($con, $sql);
$numberOfProducts = mysqli_num_rows($result);
$numberOfPages = ceil($numberOfProducts / $resultPerPage);
if ( ! isset($_GET['page']))
{
$page = 1;
} else
{
$page = $_GET['page'];
}
$pageFirstResult = ($page - 1) * $resultPerPage;
if ($searchTerm)
{
$like = implode(' OR ', $searchTerm);
$sql = "SELECT * FROM products WHERE subcategory_id = " . $subCategoryId . " AND " . $like . " LIMIT " . $pageFirstResult . ", " . $resultPerPage;
} else
{
$sql = "SELECT * FROM products WHERE subcategory_id = " . $subCategoryId . " LIMIT " . $pageFirstResult . ", " . $resultPerPage;
}
$result = mysqli_query($con, $sql);
if (mysqli_num_rows($result) != 0)
{
$productCount = 0;
?>
<div class="col-md-12" style="padding-left: 0">
<ul class="list-unstyled" id="products" data-role="list">
<?php
while ($product = mysqli_fetch_array($result))
{
?>
<li data-sort="<?php echo $product['product_price'] ?>" class="col-md-3">
<div class="thumbnail">
<a href="product_details.html"><img
src="<?php echo base_url('assets/img/') . $product['product_image']; ?>"/></a>
<div class="caption" style="height: 300px; overflow: hidden">
<h5><?php echo $product['product_name']; ?></h5>
<p><?php echo $product['product_description']; ?></p>
</div>
<div class="product_footer caption">
<?php if ($product['product_quantity'] == 0)
{ ?>
<p style="text-align: center"><span
style="color:orange"><b>Na objednavku.</b></span>
</p>
<?php } else
{ ?>
<p style="text-align: center">
<span style="color:green">
<b>Na sklade <?php echo $product['product_quantity'] ?> ks.</b>
</span>
</p>
<?php } ?>
<h3><a type="button" id="<?php echo $product['id'] ?>"
class="btn btn-success buy_button">Kupit</a>
<?php if ($this->encryption->decrypt($this->session->role) == 'Admin')
{ ?>
<button href="" type="button" id="<?php echo $product['id'] ?>"
class="btn btn-warning"
data-toggle="modal" data-target="#modal_<?php echo $productCount; ?>">
Upravit
</button>
<?php } ?>
<span class="pull-right"><?php echo $product['product_price']; ?> €</span></h3>
<div class="modal fade" id="modal_<?php echo $productCount ?>" data-backdrop="static"
data-keyboard="false">
<div class="modal-dialog">
<div class="modal-body"><?php $this->load->view('AdminProductUpdateView', array('product' => $product, 'productCount' => $productCount,
'id' => $product['id'])) ?>
</div>
</div>
</div>
<p style="text-align: center">Cena bez
DPH <?php echo $product['product_price'] - $product['product_price_dph']; ?> €</p>
</div>
</div>
</li>
<?php $productCount++; ?>
<?php
}
?>
</ul>
</div>
<div class="col-md-1">
<select class="form-control" style="min-width: 2cm" onchange="productPerPage(<?php echo $subCategoryId; ?>, this.value)">
<option selected="selected" hidden><?php echo $resultPerPage; ?></option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>10</option>
<option>20</option>
<option>50</option>
</select>
</div>
Produkty na stranku
<div class="products_pagination">
<a id="previous_page">&slarr;</a>
<?php
for ($i = 1; $i <= $numberOfPages; $i++)
{
?>
<a id="<?php echo $i; ?>"
href="<?php echo base_url('Product/index/') . $subCategoryId . '/' . $resultPerPage . '?page=' . $i; ?>"><?php echo $i . ' '; ?></a>
<?php
}
?>
<a id="next_page">→</a>
</div>
<?php } else
{ ?>
<h3 class="col-md-12">Nenasli sa ziadne produkty.</h3>
<?php } ?>
</div>
<script>
productsPaggination(<?php echo $numberOfPages; ?>);
getSubcategoryForAdminUpdate(<?php echo $isAdmin ? 1 : 0; ?>, <?php echo $numberOfProducts; ?>);
</script>
small resolution
bigger resolution
This works for me to reduce select tag's width;
<select id ="Select1" class="input-sm">
You can use any one of these classes;
class="input-sm"
class="input-md"
class="input-lg"
Since youre using col-md-1, you are giving it 1/12 of your containers space, which is very little.
I would suggest to simply give it more space, eg. col-sm-2
Try specifying the width:
select.form-control {
width:100%;
}
I am not sure if you also realise that the dropdown is in the col-md-1 container. It will appear small on small screens.

Form inputs disabled

I have two forms on my page, I wrapped the first with a new class just to restrict it to span5, and from that the forms now appear next to each other horizontally but the first is not allowing you to click into or on the elements at all.
<div class="row">
<div class="greybg-container">
<div class="span5">
<div id="login-container">
<div class="inner-content">
<h4>Login</h4>
<div class="basket-login"><div class="basket-login-text"><?php $seintro = new Page($db,'SiteElements','Login'); echo $seintro->row['pageCopy']; ?></div>
<form method="post" action="<?php echo HTTP_HOST; ?>Site/MyAccount/Login/?basketId=<?php echo $_REQUEST['basketId'] ? $_REQUEST['basketId'] : $basket->row['orderId']; ?>&wishlist=<?php echo $_GET['wishlist']; ?>&categoryId=<?php echo $_GET['categoryId']; ?>&addToBasketSize=<?php echo $_GET['addToBasketSize']; ?>">
<?php if ($errorLogin){ ?>
<span class="error"><?php echo $errorLogin; ?></span>
<?php } ?>
<table class="basket">
<?php foreach($form_login as $each){ ?>
<tr><td class="title"><?php $each->writeLabel(); ?></td>
<td><?php $each->write(); ?></td></tr>
<?php } ?>
<tr>
<td class="title">
<label for="login_userSubmit"></label>
</td>
<td class="form_button">
<input id="login_userSubmit" type="submit" size="" value="Send" onclick="" name="login_userSubmit">
<br>
<a class="grey-link" href="<?php echo HTTP_HOST; ?>Site/MyAccount/ForgotPassword">Forgot Password ?</a>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>
<div id="left">
<div class="inner-content">
<h4>Register</h4>
<div class="basket-login"><div class="basket-login-text"><?php $seintro = new Page($db,'SiteElements','Register'); echo $seintro->row['pageCopy']; ?><?php echo $page->row['pageCopy']; ?></div></div>
<form method="post" enctype="multipart/form-data">
<?php if (is_array($error)){ ?>
<strong>Please Note :</strong> The following errors have occurred
<ul>
<?php foreach($error as $id=>$each){ ?>
<li class="error"><?php $form_signup[$id]->writeLabel($each); ?></li>
<?php } ?>
</ul>
<?php } ?>
<table class="basket">
<?php if($form_signup){ foreach($form_signup as $each){ ?>
<tr>
<td class="title"><?php $each->writeLabel(); ?></td>
<td><?php $each->write(); ?></td>
<?php } } ?>
<tr>
<td class="title">
<label for="signup_submit"></label>
</td>
<td class="form_button">
<input style="width:auto;" id="signup_submit" type="submit" size="" value="Continue Registration" onclick="document.getElementById('action_submit').value='1';document.submit();" name="signup_submit">
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
the second form starts where there is div id="left". ignore the fact it says left, that's the form on the right as you'll see.
http://bit.ly/19fegdi
Span5 is overlapped by the form which on the right side. Add the following css style will fix it.
#left{
float: left;
}