<?php session_start(); error_reporting(0); include('includes/dbconnection.php'); if (strlen($_SESSION['odmsaid']==0)) { header('location:logout.php'); } else{ ?> <!doctype html> <html lang="en" class="no-focus"> <!--<![endif]--> <head> <title>Onlind DJ Management System - Search Booking</title> <link rel="stylesheet" href="assets/js/plugins/datatables/dataTables.bootstrap4.min.css"> <link rel="stylesheet" id="css-main" href="assets/css/codebase.min.css"> </head> <body> <div id="page-container" class="sidebar-o sidebar-inverse side-scroll page-header-fixed main-content-narrow"> <?php include_once('includes/sidebar.php');?> <?php include_once('includes/header.php');?> <!-- Main Container --> <main id="main-container"> <!-- Page Content --> <div class="content"> <h2 class="content-heading">Search Booking</h2> <!-- Dynamic Table Full Pagination --> <div class="block"> <div class="block-header block-header-default"> <h3 class="block-title">Search Booking</h3> </div> <div class="block-content block-content-full"> <!-- DataTables init on table by adding .js-dataTable-full-pagination class, functionality initialized in js/pages/be_tables_datatables.js --> <form id="basic-form" method="post"> <div class="form-group"> <label>Search by Booking No./Name/Mobile No.</label> <input id="searchdata" type="text" name="searchdata" required="true" class="form-control" placeholder="Booking No./Name/Mobile No."></div> <br> <button type="submit" class="btn btn-primary" name="search" id="submit">Search</button> </form> <?php if(isset($_POST['search'])) { $sdata=$_POST['searchdata']; ?> <h4 align="center">Result against "<?php echo $sdata;?>" keyword </h4> <table class="table table-bordered table-striped table-vcenter js-dataTable-full-pagination"> <thead> <tr> <th class="text-center"></th> <th>Booking ID</th> <th class="d-none d-sm-table-cell">Cutomer Name</th> <th class="d-none d-sm-table-cell">Mobile Number</th> <th class="d-none d-sm-table-cell">Email</th> <th class="d-none d-sm-table-cell">Booking Date</th> <th class="d-none d-sm-table-cell">Status</th> <th class="d-none d-sm-table-cell" style="width: 15%;">Action</th> </tr> </thead> <tbody> <?php $sql="SELECT * from tblbooking where BookingID like '$sdata%' || Name like '$sdata%' || MobileNumber like '$sdata%'"; $query = $dbh -> prepare($sql); $query->execute(); $results=$query->fetchAll(PDO::FETCH_OBJ); $cnt=1; if($query->rowCount() > 0) { foreach($results as $row) { ?> <tr> <td class="text-center"><?php echo htmlentities($cnt);?></td> <td class="font-w600"><?php echo htmlentities($row->BookingID);?></td> <td class="font-w600"><?php echo htmlentities($row->Name);?></td> <td class="font-w600"><?php echo htmlentities($row->MobileNumber);?></td> <td class="font-w600"><?php echo htmlentities($row->Email);?></td> <td class="font-w600"> <span class="badge badge-primary"><?php echo htmlentities($row->BookingDate);?></span> </td> <?php if($row->Status==""){ ?> <td class="font-w600"><?php echo "Not Updated Yet"; ?></td> <?php } else { ?> <td class="d-none d-sm-table-cell"> <span class="badge badge-primary"><?php echo htmlentities($row->Status);?></span> </td> <?php } ?> <td class="d-none d-sm-table-cell"><a href="view-booking-detail.php?editid=<?php echo htmlentities ($row->ID);?>&&bookingid=<?php echo htmlentities ($row->BookingID);?>"><i class="fa fa-eye" aria-hidden="true"></i></a></td> </tr> </tbody> <?php $cnt=$cnt+1; } } else { ?> <tr> <td colspan="8"> No record found against this search</td> </tr> <?php } }?> </table> </div> </div> <!-- END Dynamic Table Full Pagination --> <!-- END Dynamic Table Simple --> </div> <!-- END Page Content --> </main> <!-- END Main Container --> <?php include_once('includes/footer.php');?> </div> <!-- END Page Container --> <!-- Codebase Core JS --> <script src="assets/js/core/jquery.min.js"></script> <script src="assets/js/core/popper.min.js"></script> <script src="assets/js/core/bootstrap.min.js"></script> <script src="assets/js/core/jquery.slimscroll.min.js"></script> <script src="assets/js/core/jquery.scrollLock.min.js"></script> <script src="assets/js/core/jquery.appear.min.js"></script> <script src="assets/js/core/jquery.countTo.min.js"></script> <script src="assets/js/core/js.cookie.min.js"></script> <script src="assets/js/codebase.js"></script> <!-- Page JS Plugins --> <script src="assets/js/plugins/datatables/jquery.dataTables.min.js"></script> <script src="assets/js/plugins/datatables/dataTables.bootstrap4.min.js"></script> <!-- Page JS Code --> <script src="assets/js/pages/be_tables_datatables.js"></script> </body> </html> <?php } ?>
Write, Run & Share PHP code online using OneCompiler's PHP online compiler for free. It's one of the robust, feature-rich online compilers for PHP language, running on the latest version 7. Getting started with the OneCompiler's PHP compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as PHP
and start coding.
OneCompiler's PHP online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample PHP program which takes name as input and prints hello message with your name.
<?php
fscanf(STDIN, "%s\n", $name);
echo "Hello ".$name.".\n";
?>
PHP(Hypertext Preprocessor) is widely used server sripting language by Rasmus Lerdorf in the year 1994.
In PHP, there is no need to explicitly declare variables to reserve memory space. When you assign a value to a variable, declaration happens automatically. Variables are case-sensitive in PHP.
$variable_name = value;
If, If-else, Nested-Ifs are used when you want to perform a certain set of operations based on conditional expressions.
if(conditional-expression){
//code
}
if(conditional-expression){
//code if condition is true
} else {
//code if condition is false
}
if(condition-expression1) {
//code if above condition is true
} elseif(condition-expression2){
//code if above condition is true
}
elseif(condition-expression3) {
//code if above condition is true
}
...
else {
//code if all the conditions are false
}
Switch is used to execute one set of statement from multiple conditions.
switch(conditional-expression) {
case value1:
// code if the above value is matched
break; // optional
case value2:
// code if the above value is matched
break; // optional
...
default:
// code to be executed when all the above cases are not matched;
}
For loop is used to iterate a set of statements based on a condition.
for(Initialization; Condition; Increment/decrement){
// code
}
// you can use any of the below syntax
foreach ($array as $element-value) {
//code
}
foreach ($array as $key => $element-value) {
//code
}
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while(condition) {
// code
}
Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.
do {
// code
} while (condition);
Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increases re-usuability and modularity.
function function_name(parameters) {
//code
}
function_name (parameters)