I am creating a webapp for my company and one of my PHP pages keeps on
loading when I add another header.php into it, but another page is loading fine if I add this header.
my code: this section is added to the below page (view_enquiry.php)
head.php:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<!-- Favicon icon -->
<link rel="icon" type="image/png" sizes="16x16" href="images/logo.png">
<?php
include('connect.php');
$sql_head_title = "select * from manage_website";
$result_head_title = $conn->query($sql_head_title);
$row_head_title = mysqli_fetch_array($result_head_title);
?>
<title><?php echo $row_head_title['title'];?></title>
<link href="css/lib/chartist/chartist.min.css" rel="stylesheet">
<link href="css/lib/owl.carousel.min.css" rel="stylesheet" />
<link href="css/lib/owl.theme.default.min.css" rel="stylesheet" />
<!-- Bootstrap Core CSS -->
<link href="css/lib/bootstrap/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/helper.css" rel="stylesheet">
<link href="css/snackbar.css" rel="stylesheet">
<link href="css/modal.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:** -->
<!--[if lt IE 9]>
<script src="https:**oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https:**oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" href="css/lib/html5-editor/bootstrap-wysihtml5.css" />
<link href="css/lib/calendar2/semantic.ui.min.css" rel="stylesheet">
<link href="css/lib/calendar2/pignose.calendar.min.css" rel="stylesheet">
</head>
<body class="fix-header fix-sidebar">
<!-- Preloader - style you can find in spinners.css -->
<div class="preloader">
<svg class="circular" viewBox="25 25 50 50">
<circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10" /> </svg>
</div>
</body>
</html>
this is my page and this page keeps on loading (view_enquiry.php)
<?php include('head.php');?>
<?php include('header.php');?>
<?php include('sidebar.php');?>
<?php
include ('connect.php');
?>
<div class="content-wrapper" style="padding-top: 48px;">
<div class="container-fluid">
<div class="status" style="color:red;position: relative;top:215px;positin: relative;left:565px;position:absolute;">
<h4>Status Updated Successfully</h4>
</div>
<div class="row" col-sm color: #031aaf" style="padding-top: 12px;">
<div class="col-sm-3">
<h3 style="color: #828282"><b>Enquiry Details</b></h3>
</div>
<div class="col-sm-3">
<form action="" method="get" " >
<input name="search" type="text" placeholder="Search(Name/number)" size="20px">
<button type="submit" name="submit" value="search" class="button"><i class="fa fa-search"></i></button>
</form>
</div>
<div class="col-sm-5" style="text-align: left;">
<form action="between.php" method="GET" >
<input type="date" name="from" required> To
<input type="date" name="to" required>
<button type="submit" class="button"><i class="fa fa-search"></i></button>
</form>
</div>
</div>
<b><p style="text-align:right; color: #828282" > Yesterday's Enquiry Count :
<?php
$v="SELECT COUNT(id) FROM task WHERE (`date` = CURDATE() - INTERVAL 1 DAY)AND completed=0" ;
$s=mysqli_query($conn,$v);
$w=mysqli_fetch_assoc($s);
echo $w['COUNT(id)'] ;
?>
</b>
<br><br>
<table border="1px;" style="margin-top:-11px;color: #333333" bgcolor="#fcb983" >
<tr style="color: black">
<th></th>
<th>Name</th>
<th>Address</th>
<th>Enquiry Date</th>
<th>Category/Work</th>
<th>Followup Date</th>
<th>Mobile</th>
<th>Comment</th>
<th>Postponed To</th>
<th>Edit</th>
<th>Delete</th>
<th>Complete</th>
</tr>
<?php
if(#$_GET['search'] && #$_GET['search']!=''){
$query=$_GET['search'];
$query = htmlspecialchars($query);
$vari = mysqli_query($conn,"SELECT * FROM task WHERE completed=0 AND ((`task_name` LIKE '%".$query."%') OR (`mobile` LIKE '%".$query."%') OR (`address` LIKE '%".$query."%') OR (`work` LIKE '%".$query."%') OR (`command` LIKE '%".$query."%'))") or die(mysqli_error($con));
//$vari="SELECT * FROM task WHERE completed=0 AND (task_name='$s' OR mobile='$s')";
}
else{
$vari = mysqli_query($conn,"SELECT * FROM task WHERE (`date` = CURDATE() - INTERVAL 1 DAY) AND completed=0") or die(mysqli_error($conn));
//$vari="SELECT * FROM task WHERE completed=0";
}
//$variable=mysqli_query($con,$vari);
while ($row = mysqli_fetch_array($vari)){
?>
<tr>
<td><span class="glyphicon glyphicon-chevron-right"></span></td>
<td><?php echo $row["task_name"]; ?></td>
<td><?php echo $row["address"]; ?></td>
<td><?php echo date('d-m-Y',strtotime($row["date"])); ?></td>
<td><?php echo $row["work"];?></td>
<td><?php echo date('D - d-m-Y',strtotime($row["todo"])); ?></td>
<td><?php echo $row["mobile"] ;?></td>
<td><?php echo $row["command"];?></td>
<td></span></center></td>
<td></span></center></td>
<td><center><span class="fa fa-trash"></span></center></td>
<td><center><span class="fa fa-check-square"></span></center></td>
</tr>
<?php } ?>
</table>
</div>
</div>
Please help me this details
Related
I am using a while loop in PHP to extract data for some items and print each query like a separate card in the same row as in a shopping cart. Bootstrap seems to print them vertically in separate rows. Expected layout
code
<!DOCTYPE html> <html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Shopping Cart</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="cart.css"> </head> <body>
<div class="container">
<?php
$connect = mysqli_connect('localhost','root','','cart');
$query = 'SELECT * FROM products ORDER BY id ASC';
$result = mysqli_query($connect, $query);
if (mysqli_num_rows($result)>0) {
while($product = mysqli_fetch_assoc($result)){
?>
<div class="col-sm-4 col-md-3">
<form method="post" class="" action="index.html">
<div class="products ">
<img src="<?php echo $product['image']; ?>" class="img-fluid" />
<h4 class="text-info"><?php echo $product['name']; ?></h4>
<h4>INR <?php echo $product['price']; ?></h4>
<input type="text" name="quantity" class="form-control" value="1" />
<input type="submit" name="add_to_cart" class="btn btn-info" value="Add" />
</div>
</form>
</div>
<?php
}
}
?>
</div>
</body>
</html>
I have tried using class="row-fluid" before the start of the loop or even the .product but it doesn't help.
Actual output in normal screen or developer tool
To allow for the products to be shown in 'rows' (horizontally), you need to add a <div class="row"> to your HTML code. I've banged together a small demo, that shows the basic idea (and the use of HEREDOC which allows for (IMHO) cleaner separation of HTML and PHP code).
Function renderProduct() is invoked through a foreach() loop on a dummy product range stored in array $products to imitate your database while loop.
The gist:
<?php
function renderProduct($product = 'n/a') {
$htmlProduct = <<<HEREDOC
<div class="col-sm-4 col-md-3">
<form method="post" class="" action="index.html">
<div class="products ">
<img src="$product" class="img-fluid" />
<h4 class="text-info">$product</h4>
<h4>INR $product</h4>
<input type="text" name="quantity" class="form-control" value="1" />
<input type="submit" name="add_to_cart" class="btn btn-info" value="Add" />
</div>
</form>
</div>
HEREDOC;
return $htmlProduct;
}
$htmlStart = <<<HEREDOC
<!DOCTYPE html> <html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Shopping Cart</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="cart.css">
</head>
<body>
<div class="container">
<div class="row"> <!-- ADDED -->
HEREDOC;
$htmlEnd = <<<HEREDOC
</div> <!-- close row -->
</div> <!-- close container -->
</body>
</html>
HEREDOC;
// render page
echo $htmlStart;
$products = ['product1', 'product2', 'product3', 'product4', 'product5', 'product6', 'product7'];
foreach($products as $prod) {
echo renderProduct($prod);
}
echo $htmlEnd;
I am trying to retrieve data from a database and display it on the PHP file using the following code:
index.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Control Panel</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link href="css/font-awesome.min.css" rel="stylesheet">
<!-- NProgress -->
<link href="css/nprogress.css" rel="stylesheet">
<!-- iCheck -->
<link href="css/green.css" rel="stylesheet">
<!-- Datatables -->
<link href="css/dataTables.bootstrap.min.css" rel="stylesheet">
<link href="css/buttons.bootstrap.min.css" rel="stylesheet">
<link href="css/fixedHeader.bootstrap.min.css" rel="stylesheet">
<link href="css/responsive.bootstrap.min.css" rel="stylesheet">
<link href="css/scroller.bootstrap.min.css" rel="stylesheet">
<!-- Custom Theme Style -->
<link href="css/custom.min.css" rel="stylesheet">
</head>
<body class="nav-md">
<div class="container body">
<div class="main_container">
<div class="col-md-12 left_col">
<div class="left_col scroll-view">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_content">
<?php
$count_rows = 0;
include 'database_connection.php';
$sql = "SELECT date, ip, activate FROM software";
$result = $conn->query($sql);
echo "<table id='datatable-buttons class='table table-striped table-bordered'>
<tr>
<th>S/N</th>
<th>Date</th>
<th>IP Address</th>
<th>Activation</th>
</tr>";
while ($row = mysqli_fetch_array($result)) {
$count_rows++;
echo "<tr>";
echo "<td>" . $count_rows . "</td>";
echo "<td>" . $row['date'] . "</td>";
echo "<td>" . $row['ip'] . "</td>";
echo "<td>" . $row['activate'] . "</td>";
echo "</tr>";
}
mysqli_close($conn);
?>
<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="js/bootstrap.min.js"></script>
<!-- FastClick -->
<script src="js/fastclick.js"></script>
<!-- NProgress -->
<script src="js/nprogress.js"></script>
<!-- iCheck -->
<script src="js/icheck.min.js"></script>
<!-- Datatables -->
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/dataTables.buttons.min.js"></script>
<script src="js/buttons.bootstrap.min.js"></script>
<script src="js/buttons.flash.min.js"></script>
<script src="js/buttons.html5.min.js"></script>
<script src="js/buttons.print.min.js"></script>
<script src="js/dataTables.fixedHeader.min.js"></script>
<script src="js/dataTables.keyTable.min.js"></script>
<script src="js/dataTables.responsive.min.js"></script>
<script src="js/responsive.bootstrap.js"></script>
<script src="js/dataTables.scroller.min.js"></script>
<script src="js/jszip.min.js"></script>
<script src="js/pdfmake.min.js"></script>
<script src="js/vfs_fonts.js"></script>
<!-- Custom Theme Scripts -->
<script src="js/custom.min.js"></script>
</body>
</html>
I am getting the results but it's not properly formatted. With almost the same code I can get the design but not the data: Here's the code that is working but not showing the data.
index.html (Incomplete code)
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Control Panel</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link href="css/font-awesome.min.css" rel="stylesheet">
<!-- NProgress -->
<link href="css/nprogress.css" rel="stylesheet">
<!-- iCheck -->
<link href="css/green.css" rel="stylesheet">
<!-- Datatables -->
<link href="css/dataTables.bootstrap.min.css" rel="stylesheet">
<link href="css/buttons.bootstrap.min.css" rel="stylesheet">
<link href="css/fixedHeader.bootstrap.min.css" rel="stylesheet">
<link href="css/responsive.bootstrap.min.css" rel="stylesheet">
<link href="css/scroller.bootstrap.min.css" rel="stylesheet">
<!-- Custom Theme Style -->
<link href="css/custom.min.css" rel="stylesheet">
</head>
<body class="nav-md">
<div class="container body">
<div class="main_container">
<div class="col-md-12 left_col">
<div class="left_col scroll-view">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_content">
<table id="datatable-buttons" class="table table-striped table-bordered">
<thead>
<tr>
<th>S/N</th>
<th>Date</th>
<th>IP Address</th>
<th>Activation</th>
</tr>
</thead>
<tbody>
<tr>;
<td> $row['id'] </td>
<td> $row['date'] </td>
<td> $row['ip'] </td>
<td> $row['activate'] </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="js/bootstrap.min.js"></script>
<!-- FastClick -->
<script src="js/fastclick.js"></script>
<!-- NProgress -->
<script src="js/nprogress.js"></script>
<!-- iCheck -->
<script src="js/icheck.min.js"></script>
<!-- Datatables -->
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<script src="js/dataTables.buttons.min.js"></script>
<script src="js/buttons.bootstrap.min.js"></script>
<script src="js/buttons.flash.min.js"></script>
<script src="js/buttons.html5.min.js"></script>
<script src="js/buttons.print.min.js"></script>
<script src="js/dataTables.fixedHeader.min.js"></script>
<script src="js/dataTables.keyTable.min.js"></script>
<script src="js/dataTables.responsive.min.js"></script>
<script src="js/responsive.bootstrap.js"></script>
<script src="js/dataTables.scroller.min.js"></script>
<script src="js/jszip.min.js"></script>
<script src="js/pdfmake.min.js"></script>
<script src="js/vfs_fonts.js"></script>
<!-- Custom Theme Scripts -->
<script src="js/custom.min.js"></script>
</body>
</html>
Of course I know that the index.html code is Incorrect or incomplete. However it does load the bootstrap table design perfectly. What am I doing on the PHP file?
Please guide me here.
Screenshot of index.php : http://oi65.tinypic.com/z7ed3.jpg
Screenshot of index.html: http://oi68.tinypic.com/2zqqvc6.jpg
Please change your code in index.php file:
<table id='datatable-buttons class='table table-striped table-bordered'>
to
<table id='datatable-buttons' class='table table-striped table-bordered'>
you didn't close quote after id datatable-buttons
and add </table> after the end of while block
In your case, you can change your code to code below:
<table id="datatable-buttons" class="table table-striped table-bordered">
<thead>
<tr>
<th>S/N</th>
<th>Date</th>
<th>IP Address</th>
<th>Activation</th>
</tr>
</thead>
<tbody>
<?php
$count_rows = 0;
include 'database_connection.php';
$sql = "SELECT `date`, `ip`, `activate` FROM `software`";
$result = $conn->query($sql);
while ($row = mysqli_fetch_array($result)):
$count_rows++;
?>
<tr>
<td><?php echo $count_rows ?></td>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['date']; ?></td>
<td><?php echo $row['ip']; ?></td>
<td><?php echo $row['activate']; ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
I have a quote table that people insert basic information, such as name, product type etc. Which is all fine.
The admin can see the quote table and has a button to view the information in a structured manner.
Now what i have been trying to do is add a button called "Accept" and "Deny" which would move the table entry to the Denied or accepted table (same structure as the quote table)
I have looked around on google but only found assistance in making a button to delete entries or add new entries.
Below is the admin quote viewing page code with the view button:
<?php
session_start();
include("dbconnection.php");
include("checklogin.php");
check_login();
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta charset="utf-8" />
<title>Admin | Manage Logged Claims</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta content="" name="description" />
<meta content="" name="author" />
<link href="assets/plugins/bootstrap-select2/select2.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="assets/plugins/jquery-datatable/css/jquery.dataTables.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/datatables-responsive/css/datatables.responsive.css"
rel="stylesheet" type="text/css" media="screen"/>
<link href="assets/plugins/boostrapv3/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/boostrapv3/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/animate.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/jquery-scrollbar/jquery.scrollbar.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/style.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/responsive.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/custom-icon-set.css" rel="stylesheet" type="text/css"/>
</head>
<body class="">
<?php include("header.php");?>
<div class="page-container row">
<?php include("leftbar.php");?>
<div class="clearfix"></div>
<!-- END SIDEBAR MENU -->
</div>
</div>
<div class="page-content">
<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
<div id="portlet-config" class="modal hide">
<div class="modal-header">
<button data-dismiss="modal" class="close" type="button"></button>
<h3>Widget Settings</h3>
</div>
<div class="modal-body"> Widget settings form goes here </div>
</div>
<div class="clearfix"></div>
<div class="content">
<ul class="breadcrumb">
<li>
<p>YOU ARE HERE</p>
</li>
<li>Claims Logged </li>
</ul>
<div class="page-title"> <i class="icon-custom-left"></i>
<h3>Manage Logged Claims</h3>
</div>
<div class="row-fluid">
<div class="span12">
<div class="grid simple ">
<div class="grid-title">
<h4>Table <span class="semi-bold">Styles</span></h4>
<div class="tools">
<a href="javascript:;" class="remove">
</a> </div>
</div>
<div class="grid-body ">
<table class="table table-hover table-condensed" id="example">
<thead>
<tr>
<th style="width:1%">#</th>
<th style="width:10%">Name</th>
<th style="width:10%" data-hide="phone,tablet">Email</th>
<th style="width:10%">Contact no</th>
<th style="width:20%" data-hide="phone,tablet">Claim Requested</th>
<th style="width:10%">Action </th>
</tr>
</thead>
<tbody>
<?php $ret=mysql_query("select * from prequest order by id desc");
$cnt=1;
while($row=mysql_fetch_array($ret))
{?>
<tr >
<td class="v-align-middle"><?php echo $cnt;?></td>
<td class="v-align-middle"><?php echo $row['name'];?></td>
<td class="v-align-middle"><span class="muted"><?php echo $row['email'];?></span></td>
<td><span class="muted"><?php echo $row['contactno'];?>
</span></td>
<td class="v-align-middle"><?php echo $row['wdd'];?>
<?php echo $row['cms'];?>
<?php echo $row['seo'];?>
<?php echo $row['smo'];?>
<?php echo $row['swd'];?>
<?php echo $row['dwd'];?>
<?php echo $row['fwd'];?>
<?php echo $row['dr'];?>
<?php echo $row['whs'];?>
<?php echo $row['wm'];?>
<?php echo $row['ed'];?>
<?php echo $row['wta'];?>
<?php echo $row['opi'];?>
<?php echo $row['ld'];?>
<?php echo $row['da'];?>
<?php echo $row['osc'];?>
<?php echo $row['nd'];?>
<?php echo $row['others'];?>
</td>
<td><button class="btn-danger-dark">View</button></td> <--VIEW BUTTON
</tr>
<?php $cnt=$cnt+1; } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="addNewRow"></div>
</div>
</div>
<script src="assets/plugins/jquery-1.8.3.min.js" type="text/javascript">
</script>
<script src="assets/plugins/jquery-ui/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>
<script src="assets/plugins/boostrapv3/js/bootstrap.min.js" type="text/javascript"></script>
<script src="assets/plugins/breakpoints.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-unveil/jquery.unveil.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-scrollbar/jquery.scrollbar.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-block-ui/jqueryblockui.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-numberAnimate/jquery.animateNumbers.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-select2/select2.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-datatable/js/jquery.dataTables.min.js" type="text/javascript" ></script>
<script src="assets/plugins/jquery-datatable/extra/js/dataTables.tableTools.min.js" type="text/javascript" >
</script>
<script type="text/javascript" src="assets/plugins/datatables-responsive/js/datatables.responsive.js"></script>
<script type="text/javascript" src="assets/plugins/datatables-responsive/js/lodash.min.js"></script>
<script src="assets/js/datatables.js" type="text/javascript"></script>
<script src="assets/js/core.js" type="text/javascript"></script>
<script src="assets/js/chat.js" type="text/javascript"></script>
<script src="assets/js/demo.js" type="text/javascript"></script>
</body>
</html>
Have you considered a different approach?
If the two tables have the exact same structure, then all you need is a single table and add a column called 'accepted' and use 1 and 0 values to act as true and false.
Then you can search this single table WHERE 'accepted' = 1 for accepted entries, or 0 for denied entries. And to change an entry's status, simply update a single column. Much easier.
Example:
$result = mysqli_query("SELECT * FROM tableName WHERE accepted = 1");
That will get only entries you have marked as accepted.
Change it to WHERE accepted = 0" to get the denied entries.
And here is how you can allow the admin to change an entry's accepted/denied status easily:
$update = mysqli_query("UPDATE tableName SET accepted = 1 WHERE id = 12345");
By the way, I suggest you use mysqli instead of mysql, heres a good answer why.
index.php
<?php
session_start();
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type"content="text/html;charset=UTF-8">
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery- .min.js"
type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>
<link href="style1.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" media="screen and (max-width: 360px)" href="portrait.css">
<link rel="stylesheet" type="text/css" media="screen and (min-width: 361px) and (max-width: 480px)" href="landscape.css">
<link rel="stylesheet" type="text/css" media="screen and (min-width: 481px)" href="desktop.css">
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"
rel="Stylesheet"type="text/css"/>
</head>
<body>
<div id="container">
<div id="banner">
</div>
<div class="clear"></div>
</br></br></br>
<br /><br /><br /><br />
<?php echo $reg; ?>
<form action="login.php" method="post" enctype="multipart/form-data">
<table border="2" align="center" width="400px" cellspacing="0" cellpadding="2" style="border-color:#FFF;">
<tr>
<td align="center" style="background:#4CAF50; font-weight:bold;" colspan="2">लॉगिन</td>
</tr>
<tr>
<td>यूजर का नाम: </td>
<td><input type="text" name="name" size="25"></td>
</tr>
<tr>
<td>पासवर्ड:</td>
<td><input type="password" name="password" size="25"></td>
</tr>
<tr>
<td align="center" colspan="2"><input type="Submit" value="submit"></td>
</tr>
</table>
</form>
</br></br></br></br></br></br></br></br></br>
</div>
</body>
</html>
2.login.php
<?php
session_start();
$name=$_REQUEST['name'];
$password=$_REQUEST['password'];
if($name=='admin' && $password=='admin')
{
session_start();
$_SESSION['sid']=session_id();
header('location:template.php');
}
else
{
header('location:index.php');
$_SESSION['reg']="<font color=#800000; size=4>Invalid User Name and Password. Please Enter Again.</font>";
}
?>
template.php
<meta http-equiv="Content-Type"content="text/html;charset=UTF-8">
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"
type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>
<link href="style1.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" media="screen and (max-width: 360px)" href="portrait.css">
<link rel="stylesheet" type="text/css" media="screen and (min-width: 361px) and (max-width: 480px)" href="landscape.css">
<link rel="stylesheet" type="text/css" media="screen and (min-width: 481px)" href="desktop.css">
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"
rel="Stylesheet"type="text/css"/>
</head>
<body>
<div id="container">
<div id="navbar">
<ul>
<li align="center">मुख पृष्ठ </li>
<li align="center">निविदा</li>
<li align="center">कार्य आदेश </li>
<li align="center">वेतन</li>
<li align="center">दुकान </li>
<li align="center">स्टॉक</li>
<li align="center">विविध</li>
<li align="center">लेखा-जोखा</li>
<li align="center">लोग आउट</li>
</ul>
</div>
<div class="clear"></div>
<div id="content">
<br/><br/><br/><br/>
<center><img src=images/looks-solid.jpg width=500 height=250 alt=Edit /></center>
</br> </br><br/><br/>
</div>
<div id="bottom"></div>
<div class="clear"></div>
<?php }
else
{
header("location:index.php");
}
?>
</div>
</body>
</html>
logout.php
session_start();
session_destroy();
setcookie(PHPSESSID,session_id(),time()-1);
header('location:index.php');
?>
My session is not working on online project, but on localhost,it is working correctly. I want after logout, on pressing back button it should not show the page,that it shows after login.
I develop a jQuery mobile site and want to display pie chart, the data fetch form database to show in pie chart. Since the jQuery mobile link to another page using div, I make one div in index.php to display data from database, then when the data is showing up, I can view the data by click on the view link. At this part, I make jQuery load to load page piechart.php when click on the view link. The piechart.php page success called by jQuery load, but pie chart not appear, BUT if I right click on page and click view inspect element, it starts showing up normally the pie chart.
Why do I need to right click to display it??
This is index.php
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SSPIC</title>
<meta name="viewport" content="width=device-width, maximum-scale=1.0, minimum-scale=1.0, initial-scale=1" />
<meta name="description" content="This site was created from a template originally designed and developed by Codify Design Studio. Find more free templates at http://www.adobe.com/devnet/author_bios/chris_converse.html" />
<link href="jquery-mobile/jquery.mobile.structure-1.0.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/formcalculations.js"></script>
<link href="styles/cakeform.css" rel="stylesheet" type="text/css" />
<script src="jquery-mobile/jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="jquery-mobile/jquery.mobile-1.0.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="themes/my_company.min.css" />
<link rel="stylesheet" href="includes/overrides.css" />
<script type="text/javascript" src="includes/custom.js"></script>
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<link href="stylesheets/app.css" media="screen, projector, print" rel="stylesheet" type="text/css" />
<link href="stylesheets/pizza.css" media="screen, projector, print" rel="stylesheet" type="text/css" />
<script src="javascripts/vendor/snap.svg.js"></script>
<script src="javascripts/pizza.js"></script>
<script type="text/javascript">
function MM_popupMsg(msg) { //v1.0
alert(msg);
}
</script>
</head>
<body onload='hideTotal()'>
<div data-role="page" id="home" data-theme="a">
<div data-role="header">
<h1>Homepage</h1>
</div>
<div data-role="content">
<ul data-role="listview">
<li class="btn_a">About Us</li>
<li class="btn_s">Services</li>
<li class="btn_l">Search</li>
<li class="btn_c">Upload</li>
<li class="btn_c">Chart</li>
</ul>
</div>
<div data-role="">
</div>
</div>
<div data-role="page" id="locations" data-title="Find a Locations">
<div data-role="header">
<h1>Search Data</h1>
back
</div>
<div data-role="content">
<p></p>
<h2>Search Data</h2>
</div>
<div data-role="footer">
<div data-role="controlgroup" data-type="horizontal">
Home
</div>
<h4>©2013 SSPIC</h4>
</div>
</div>
<div data-role="page" id="contact_us" data-title="Contact Us">
<div data-role="header">
<h1>Upload</h1>
back
</div>
<div data-role="content" class="content_container">
<p><form action="insertimage.php" method="post" enctype="multipart/form-data" name="form1">
<h2 align="center"> </h2>
<h2 align="center">Information</h2>
<table width="63%" border="1" align="center">
<tr>
<td width="40%">Upload File</td>
<td width="60%"><input name="pic" type="file" id="pic" /></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit" value="Submit" />
</div></td>
</tr>
</table>
<p align="center"> </p>
<p align="center"> </p>
<p align="center">
</form></p>
</div>
<div data-role="footer">
<div data-role="controlgroup" data-type="horizontal">
Home
</div>
<h4>©2013 SSPIC</h4>
</div>
</div>
<div data-role="page" id="chart" data-title="chart Us" class="chart">
<div data-role="header">
<h1>Pie Chart</h1>
back
</div>
<div id="output" data-role="content" class="content_container"></div>
<div data-role="content" class="content_container" id="k_chart">
<p>
<form action="insertimage.php" method="post" enctype="multipart/form-data" name="form1">
<h2 align="center"> </h2>
<h2 align="center">Display File</h2>
<table width="63%" border="1" align="center" class="table_chart">
<tr>
<td width="40%">Bil</td>
<td width="60%">Pusat rawatan</td>
<td width="60%">Pengasas</td>
<td width="60%">Bil pengamal</td>
<td width="60%">Total</td>
<td width="60%">Phone number</td>
<td width="60%">Peratus</td>
<td width="60%">view chart</td>
</tr>
<?php
include("connection.php");
$sel = mysql_query("select * from info");
$a = 1;
while($get_sel = mysql_fetch_array($sel))
{
?>
<tr>
<td width="40%"><?php echo $a++;?></td>
<td width="60%"><?php echo $get_sel['nama_PusatRawatan'];?></td>
<td width="40%"><?php echo $get_sel['nama_Pengasas'];?></td>
<td width="60%"><?php echo $get_sel['bilangan_Pengamal'];?></td>
<td width="40%"><?php echo $get_sel['totalPrice'];?></td>
<td width="60%"><?php echo $get_sel['phonenumber'];?></td>
<td width="60%"><?php echo $get_sel['peratus'];?></td>
<td width="60%"><div class="id"><?php echo $get_sel['id'];?></div><span class="viewBtn">View</span></td>
</tr>
<?php
}
?>
</table>
<p align="center"> </p>
<p align="center"> </p>
<p align="center">
</form></p>
</div>
<div data-role="footer">
<div data-role="controlgroup" data-type="horizontal">
Home
</div>
<h4>©2013 SSPIC</h4>
</div>
</div>
<script>
$(document).ready(function(e) {
// Pizza.init();
$('.viewBtn').on('click',function()
{
var id = $(this).closest('td').find('.id').text();
$('#k_chart').hide();
$('#output').load("piechart.php?id="+id);//load page to display pie chart
});
$(window).load(function() {
Pizza.init({
donut: false, // enable donut chart
donut_inner_ratio: 0.4, // between 0 and 1
percent_offset: 35, // relative to radius
stroke_color: '#333',
stroke_width: 0,
show_percent: true, // show or hide the percentage on the chart.
animation_speed: 500,
animation_type: 'elastic' // options: backin, backout, bounce, easein, easeinout, easeout, linear
});
});
});
</script>
</body>
</html>
This one is piechart.php
<link href="jquery-mobile/jquery.mobile.structure-1.0.min.css" rel="stylesheet" type="text/css" />
<script src="jquery-mobile/jquery.mobile-1.0.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="themes/my_company.min.css" />
<link rel="stylesheet" href="includes/overrides.css" />
<link href="stylesheets/app.css" media="screen, projector, print" rel="stylesheet" type="text/css" />
<link href="stylesheets/pizza.css" media="screen, projector, print" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script><script src="javascripts/vendor/snap.svg.js"></script>
<script src="javascripts/pizza.js"></script>
<div data-role="content" class="content_container">
<p>
<div id="jquery-script-menu">
<div class="jquery-script-center">
<div class="jquery-script-clear"></div>
</div>
</div>
<h1 style="margin-top:150px;" align="center">Papar peratus lulus pie chart </h1>
<div class="row">
<div class="large-12 columns">
<h3>Graphs</h3>
</div>
</div>
<?php
include("connection.php");
$id_info = $_GET['id'];
$papar = mysql_query("select *from info where id = '$id_info'");
$get_papar = mysql_fetch_array($papar);
if($get_papar['peratus']>0 and $get_papar['peratus']<=50)
{
$xlulus = $get_papar['peratus'];
$lulus = 100 - $xlulus;
}
else
{
$lulus = $get_papar['peratus'];
$xlulus = 100 - $lulus;
}
?>
<div class="row">
<div class="large-4 small-4 columns">
<ul data-pie-id="svg">
<li data-value="<?php echo $xlulus;?>">Tidak memenuhi syarat</li><li data-value="<?php echo $lulus;?>">Memenuhi syarat</li>
</ul>
</div>
<div class="large-8 small-8 columns">
<div id="svg"></div>
</div>
</div>
</p>
</div>
The jQuery code is at the bottom of page index.php..
You need to correctly time your plugin initialization.
First forget about document ready and window load, they will not work correctly with jQuery Mobile application (usually they trigger before jQuery Mobile content is successfully enhanced).
Instead you should learn how to use jQuery Mobile page events, for example pageinit event exists to replace document ready.
Read more about it here.
Now regarding your main problem, your plugin must be initialized during the pageshow event. A lot of visual plugins (carousels, charts ..) require correct page height. When working with jQuery Mobile page height is correctly calculated only during pageshow event, it will be 0 in any other case.
Page event initialization order can be found here.