Arranging bootstrap cards based on id in mysql and php - php

I want to gather the ordered foods of each Order ID ,I mean separate them based on their order ID
here is my code :
<?php
$sql = "select * from view_orderlist_perm where state =1 ";
$result = mysqli_query($connection, $sql);
while ($row = $result->fetch_assoc()) {
?>
<div class="d-flex flex-row">
<div class="card " style="width: 210px;border: none">
<div class="card-body mr-2">
<div class="card-header">
<?php echo $row["orderId"] ?>
</div>
<ol class="list-group flex-row justify-content-between ">
<li class="list-group-item d-flex justify-content-between align-items-center"><?php echo $row['fName'] ?>
<span class="badge badge-warning ml-2 badge-pill"><?php echo $row['qty'] ?></span>
</li>
<li class="list-group-item"><input type="checkbox" class=" mr-3 mt-2 form-control"
name="<?php echo $row['orderId'] ?>"
value="<?php echo $row['fId'] ?>" id="foodReady">
</li>
</ol>
</div>
</div>
</div>
<?php
}?>
That's how I want it to looks like
And the output of my codes look like this
And here is my view

Related

PHP categories showing only one item

I'm trying to create a categories list, where user will be able to choose item with certain category, but as soon as I'm opening any of the categories, where "soon = '2'", there is only one item coming up. Everything else works.
The code bellow is for categories, where user can chose which caegory s/he want to see.
//navbar.php
<!-- Categories -->
<div class="dropdown-item menu_cat" type="button" id="catMenuButton"><i class="fas fa-caret-left"></i> Categories</div>
<form method="POST" class="dropdown-menu dropleft categories_menu row" id="cat_dropdown">
<button class="dropdown-item" name="candle"> Candles</button>
<button class="dropdown-item" name="cloth"> Clothes</button>
<button type="submit"class="dropdown-item" name="tech"> Tech</button>
</form>
Than here is everything else, that is suppose to exectute commands that will show products from category that user choose. The issue comes upp where 'if($row["soon"] == "2")' is.
//products.php
<?php
if(isset($_POST['candle'])){
$sql = "SELECT * FROM products WHERE category = 'candle'";
}else if(isset($_POST['cloth'])){
$sql = "SELECT * FROM products WHERE category = 'cloth'";
}else if(isset($_POST['tech'])){
$sql = "SELECT * FROM products WHERE category = 'tech'";
}else{
$sql = "SELECT * FROM products";
}
$result = $conn->query($sql);
if (!empty($result) && $result->num_rows > 0) {
while ($row = $result->fetch_assoc()){
if($row["soon"] == "2"){
?>
<div class="product_card col-xl-3 col-lg-4 col-md-5 col-sm-12 box-shadow">
<div class="card-header">
<h3 class="product_name my-0 font-weight-normal"> <?php echo $row["productName"] ?> </h3>
</div>
<div class="card-body">
<h2 class="card-title pricing-card-title"> </h2>
<img class="pic" src="productsImages\<?php echo $row["productID"]; ?>.jpeg" height="150px" width="120px"></img>
<br>
<p>
<?php echo $row["productPrice"]; ?> SEK
</p>
<a class="toProduct" href="products_index.php?id=<?php echo $row['productID'] ?>">
<div class="row">
<button class="btn_to_product btn btn-lg btn-outline-dark col-lg-10 col-md-10"> Go to product <i type="button" class="fas fa-arrow-alt-circle-right"></i></button>
</div>
</a>
</div>
</div>
<?php }else if($row['soon'] == "1" && isset($_POST['tech']) || isset($_POST['candle'])){?>
<div class="product_card col-xl-3 col-lg-4 col-md-5 col-sm-12 box-shadow">
<div class="card-header">
<h3 class="product_name my-0 font-weight-normal"> <?php echo $row["productName"] ?> </h3>
</div>
<div class="card-body">
<h2 class="card-title pricing-card-title"> </h2>
<img class="pic_soon" src="productsImages/comingSoon.png" height="150px" width="120px"></img>
<style>
</style>
<br>
<p>
<?php echo $row["productPrice"]; ?> SEK
</p>
<a class="toProduct" href="products_index.php?id=<?php echo $row['productID'] ?>">
<div class="row">
<button class="btn_to_product btn btn-lg btn-outline-dark col-lg-10 col-md-10"> Go to product <i type="button" class="fas fa-arrow-alt-circle-right"></i></button>
</div>
</a>
</div>
</div>
<?php
}
}
}
else if(empty($result) || $result->num_rows == 0){
echo "<h2 class='col-12'> Sorry! </h2>";
echo "<h3 class='col-12'> There is not any product in this category yet! </h3>";
}
$conn->close();
?>
In the original post was duplicate $row = $result->fetch_assoc(); statement.
In updated post there is first condition out of the while loop.
Solution bellow is wrapping all the if($row['soon'] into the while loop:
<div class="card-deck col-lg-12 col-md-12 col-sm-12 justify-content-center text-center">
<?php
if(isset($_POST['candle'])){
$sql = "SELECT * FROM products WHERE category = 'candle'";
}else if(isset($_POST['cloth'])){
$sql = "SELECT * FROM products WHERE category = 'cloth'";
}else if(isset($_POST['tech'])){
$sql = "SELECT * FROM products WHERE category = 'tech'";
}else{
$sql = "SELECT * FROM products";
}
$result = $conn->query($sql);
if (!empty($result) && $result->num_rows > 0) {
while ($row = $result->fetch_assoc()){
if($row['soon'] == "1" && isset($_POST['tech']) || isset($_POST['candle'])){
echo "<h2 class='col-12'> Sorry! </h2>";
echo "<h3 class='col-12'> This product will be soon avaiable </h3>";
}
if($row["soon"] == "2"){
?>
<div class="product_card col-xl-3 col-lg-4 col-md-5 col-sm-12 box-shadow">
<div class="card-header">
<h3 class="product_name my-0 font-weight-normal"> <?php echo $row["productName"] ?> </h3>
</div>
<div class="card-body">
<h2 class="card-title pricing-card-title"> </h2>
<img class="pic" src="productsImages\<?php echo $row["productID"]; ?>.jpeg" height="150px" width="120px"></img>
<br>
<p>
<?php echo $row["productPrice"]; ?> SEK
</p>
<a class="toProduct" href="products_index.php?id=<?php echo $row['productID'] ?>">
<div class="row">
<button class="btn_to_product btn btn-lg btn-outline-dark col-lg-10 col-md-10"> Go to product <i type="button" class="fas fa-arrow-alt-circle-right"></i></button>
</div>
</a>
</div>
</div>
<?php
}
}
}else if($result->num_rows == 0){
echo "<h2 class='col-12'> Sorry! </h2>";
echo "<h3 class='col-12'> There is not any product in this category yet! </h3>";
}
$conn->close();
?>
</div>
}
}else if($result->num_rows == 0){
echo "<h2 class='col-12'> Sorry! </h2>";
echo "<h3 class='col-12'> There is not any product in this category yet! </h3>";
}
$conn->close();
?>
</div>
Recommendation: Always debug your scripts with enabled PHP Error Reporting!
products.php
<?php
if(isset($_POST['candle'])){
$sql = "SELECT * FROM products WHERE category = 'candle'";
}else if(isset($_POST['cloth'])){
$sql = "SELECT * FROM products WHERE category = 'cloth'";
}else if(isset($_POST['tech'])){
$sql = "SELECT * FROM products WHERE category = 'tech'";
}else{
$sql = "SELECT * FROM products";
}
$result = $conn->query($sql);
if (!empty($result) && $result->num_rows > 0) {
while ($row = $result->fetch_assoc()){
if($row["soon"] == "2"){
?>
<div class="product_card col-xl-3 col-lg-4 col-md-5 col-sm-12 box-shadow">
<div class="card-header">
<h3 class="product_name my-0 font-weight-normal"> <?php echo $row["productName"] ?> </h3>
</div>
<div class="card-body">
<h2 class="card-title pricing-card-title"> </h2>
<img class="pic" src="productsImages\<?php echo $row["productID"]; ?>.jpeg" height="150px" width="120px"></img>
<br>
<p>
<?php echo $row["productPrice"]; ?> SEK
</p>
<a class="toProduct" href="products_index.php?id=<?php echo $row['productID'] ?>">
<div class="row">
<button class="btn_to_product btn btn-lg btn-outline-dark col-lg-10 col-md-10"> Go to product <i type="button" class="fas fa-arrow-alt-circle-right"></i></button>
</div>
</a>
</div>
</div>
<?php }else if($row['soon'] == "1" && isset($_POST['tech']) || isset($_POST['candle'])){?>
<div class="product_card col-xl-3 col-lg-4 col-md-5 col-sm-12 box-shadow">
<div class="card-header">
<h3 class="product_name my-0 font-weight-normal"> <?php echo $row["productName"] ?> </h3>
</div>
<div class="card-body">
<h2 class="card-title pricing-card-title"> </h2>
<img class="pic_soon" src="productsImages/comingSoon.png" height="150px" width="120px"></img>
<style>
</style>
<br>
<p>
<?php echo $row["productPrice"]; ?> SEK
</p>
<a class="toProduct" href="products_index.php?id=<?php echo $row['productID'] ?>">
<div class="row">
<button class="btn_to_product btn btn-lg btn-outline-dark col-lg-10 col-md-10"> Go to product <i type="button" class="fas fa-arrow-alt-circle-right"></i></button>
</div>
</a>
</div>
</div>
<?php
}
}
}
else if(empty($result) || $result->num_rows == 0){
echo "<h2 class='col-12'> Sorry! </h2>";
echo "<h3 class='col-12'> There is not any product in this category yet! </h3>";
}
$conn->close();
?>

Value are not storing in database

When i put the value from this page its not saving my value in database. The program stopped on this link www.mywebsite.com/index.php?admin/manage_language/update_phrase/english and show a blank page. whenever i run on my local machine its run successfully. update the record and come back to again on www.mywebsite.com/index.php?admin/manage_language/edit_phrase/english on this link. But on my cpanel its not working well.
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<ul class="nav nav-tabs nav-bordered mb-3">
<?php if(isset($edit_profile)):?>
<li class="nav-item">
<a href="#edit" data-toggle="tab" aria-expanded="true" class="nav-link active">
<?php echo get_phrase('edit_phrase');?>
</a>
</li>
<?php endif;?>
<li class="nav-item">
<a href="#list" data-toggle="tab" aria-expanded="false" class="nav-link <?php if(!isset($edit_profile))echo 'active';?>">
<i class="mdi mdi-home-variant d-lg-none d-block mr-1"></i>
<span class="d-none d-lg-block"><?php echo get_phrase('language_list');?></span>
</a>
</li>
<li class="nav-item">
<a href="#add" data-toggle="tab" aria-expanded="true" class="nav-link">
<i class="mdi mdi-account-circle d-lg-none d-block mr-1"></i>
<span class="d-none d-lg-block"><?php echo get_phrase('add_phrase');?></span>
</a>
</li>
<li class="nav-item">
<a href="#add_lang" data-toggle="tab" aria-expanded="false" class="nav-link">
<i class="mdi mdi-settings-outline d-lg-none d-block mr-1"></i>
<span class="d-none d-lg-block"><?php echo get_phrase('add_language');?></span>
</a>
</li>
</ul>
<div class="tab-content">
<!----PHRASE EDITING TAB STARTS-->
<?php if (isset($edit_profile)):?>
<div class="tab-pane show active" id="edit" style="padding: 30px">
<div class="">
<div class="row">
<?php
$current_editing_language = $edit_profile;
echo form_open(base_url() . 'index.php?admin/manage_language/update_phrase/english' , array('id' => 'phrase_form'));
$count = 1;
$language_phrases = $this->db->query("SELECT `phrase_id` , `phrase` , `$current_editing_language` FROM `language`")->result_array();
foreach($language_phrases as $row)
{
$count++;
$phrase_id = $row['phrase_id']; //id number of phrase
$phrase = $row['phrase']; //basic phrase text
$phrase_language = $row[$current_editing_language]; //phrase of current editing language
?>
<!----phrase box starts-->
<div class="col-md-12">
<div class="tile-stats tile-gray">
<div class="icon"><i class="entypo-mail"></i></div>
<h5><?php echo $row['phrase'];?></h5>
<p>
<input type="text" name="phrase<?php echo $row['phrase_id'];?>"
value="<?php echo $phrase_language;?>" class="form-control"/>
</p>
</div>
</div>
<!----phrase box ends-->
<?php
}
?>
</div>
<input type="hidden" name="total_phrase" value="<?php echo $count;?>" />
<input type="submit" value="<?php echo get_phrase('update_phrase');?>" onClick="document.getElementById('phrase_form').submit();" class="btn btn-primary"/>
<?php
echo form_close();
?>
</div>
</div>
<?php endif;?>
<!----PHRASE EDITING TAB ENDS-->
<!----TABLE LISTING STARTS-->
<div class="tab-pane <?php if(!isset($edit_profile))echo 'show active';?>" id="list">
<div class="table-responsive-sm">
<table class="table table-bordered table-centered mb-0">
<thead>
<tr>
<th><?php echo get_phrase('language');?></th>
<th><?php echo get_phrase('option');?></th>
</tr>
</thead>
<tbody>
<?php
$fields = $this->db->list_fields('language');
foreach($fields as $field)
{
if($field == 'phrase_id' || $field == 'phrase')continue;
?>
<tr>
<td><?php echo ucwords($field);?></td>
<td>
<a href="<?php echo base_url();?>index.php?admin/manage_language/edit_phrase/<?php echo $field;?>"
class="btn btn-info">
<?php echo get_phrase('edit_phrase');?>
</a>
<a href="<?php echo base_url();?>index.php?admin/manage_language/delete_language/<?php echo $field;?>"
class="btn btn-danger">
<?php echo get_phrase('delete_language');?>
</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<!----TABLE LISTING ENDS--->
<!----PHRASE CREATION FORM STARTS---->
<div class="tab-pane box" id="add" style="padding: 30px">
<div class="box-content">
<?php echo form_open(base_url() . 'index.php?admin/manage_language/add_phrase/' , array('class' => 'form-horizontal form-groups-bordered validate', 'style' => 'width:100%;'));?>
<div class="padded">
<div class="form-group justify-content-md-center">
<label class="col-3 control-label"><?php echo get_phrase('phrase');?></label>
<div class="col-5">
<input type="text" class="form-control" name="phrase" data-validate="required" data-message-required="<?php echo get_phrase('value_required');?>" placeholder="e.g. name, email"/>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-5">
<button type="submit" class="btn btn-info"><?php echo get_phrase('add_phrase');?></button>
</div>
</div>
<?php echo form_close();?>
</div>
</div>
<!----PHRASE CREATION FORM ENDS--->
<!----ADD NEW LANGUAGE---->
<div class="tab-pane box" id="add_lang" style="padding: 30px">
<div class="box-content">
<?php echo form_open(base_url() . 'index.php?admin/manage_language/add_language/' , array('class' => 'form-horizontal form-groups-bordered validate', 'style' => 'width:100%;'));?>
<div class="padded">
<div class="form-group">
<label class="col-sm-3 control-label"><?php echo get_phrase('language');?></label>
<div class="col-sm-5">
<input type="text" class="form-control" name="language" data-validate="required" data-message-required="<?php echo get_phrase('value_required');?>" placeholder="e.g. Spanish, Portugese"/>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-5">
<button type="submit" class="btn btn-info"><?php echo get_phrase('add_language');?></button>
</div>
</div>
<?php echo form_close();?>
</div>
</div>
<!----LANGUAGE ADDING FORM ENDS-->
</div>
</div>
</div>
</div>

Dynamic bootstrap tabs using php and mysql

I have Bootstrap modal tabs and it is works fine without data loop. I am trying to fill tabs using data from db(fetch), but it is not working when i am changing tabs, how can call my required tab data on press to my tab? I know that I have problem with looping or maybe "active"- class of tabs. Here is my code. What is wrong?
<div class="row">
<div class="col">
<div class="row">
<div class="col-sm-4">
<h4 class="mb-4">Ölkələr</h4>
</div>
</div>
<div class="row">
<?php
$conn = connect_to_bd();
mysqli_set_charset($conn,"utf8");
$selectolke = mysqli_query($conn, "Select t.ID as tid,t.text_az as textaz, c.textid as textid, c.olkeflag as olkeflag, c.id as cid, c.country_az as country_az from countries c, text t where t.id = c.textid");
while($selectolkerow = mysqli_fetch_array($selectolke))
{
$textid = $selectolkerow["textid"];
$country_az = $selectolkerow["country_az"];
$olkeflag = $selectolkerow["olkeflag"];
$olkeid = $selectolkerow["cid"];
?>
<div class="col-lg-4">
<div class="tabs tabs-vertical tabs-left tabs-navigation">
<ul class="nav nav-tabs col-sm-3">
<li class="nav-item active">
<a class="nav-link" href="#tabsNavigation<?php echo $textid; ?>" data-toggle="tab"><img src="lib/png/<?php echo $olkeflag; ?>.png"> <?php echo $country_az; ?></a>
</li>
</ul>
</div>
</div>
<div class="col-lg-8">
<div class="tab-pane tab-pane-navigation active" id="tabsNavigation<?php echo $textid; ?>">
<h4><?php echo header_subname_olke_select_az($olkeid); ?></h4>
<p class="notworkingcss" style="color: #fff;font-family:Verdana, sans-serifsans-serif;text-shadow: black 1px 1px 2px;font-size: 1.2em;">
<?php echo text_olke_select_az($textid, $olkeid); ?>
</p>
<div class="row portfolio-list lightbox m-0" data-plugin-options="{'delegate': 'a.lightbox-portfolio', 'type': 'image', 'gallery': {'enabled': true}}">
<div class="col-12 col-sm-6 col-lg-3">
<div class="portfolio-item">
<span class="thumb-info thumb-info-lighten thumb-info-centered-icons">
<span class="thumb-info-wrapper">
<img src="img/products/yerli/1.jpg" class="img-fluid" alt="Et mehsullari">
<span class="thumb-info-action">
<a href="img/products/yerli/1.jpg" class="lightbox-portfolio">
<span class="thumb-info-action-icon thumb-info-action-icon-light"><i class="fa fa-search-plus"></i></span>
</a>
</span>
</span>
</span>
</div>
</div>
<div class="col-12 col-sm-6 col-lg-3">
<div class="portfolio-item">
<span class="thumb-info thumb-info-lighten thumb-info-centered-icons">
<span class="thumb-info-wrapper">
<img src="img/products/yerli/2.jpg" class="img-fluid" alt="Et mehsullari">
<span class="thumb-info-action">
<a href="img/products/yerli/2.jpg" class="lightbox-portfolio">
<span class="thumb-info-action-icon thumb-info-action-icon-light"><i class="fa fa-search-plus"></i></span>
</a>
</span>
</span>
</span>
</div>
</div>
<div class="col-12 col-sm-6 col-lg-3">
<div class="portfolio-item">
<span class="thumb-info thumb-info-lighten thumb-info-centered-icons">
<span class="thumb-info-wrapper">
<img src="img/products/yerli/3.jpg" class="img-fluid" alt="Et mehsullari">
<span class="thumb-info-action">
<a href="img/products/yerli/3.jpg" class="lightbox-portfolio">
<span class="thumb-info-action-icon thumb-info-action-icon-light"><i class="fa fa-search-plus"></i></span>
</a>
</span>
</span>
</span>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>

php select option from dropdown

I am working on a project I need to select option from html dropdown list and then display the data selected from database. Just like filter and display the filtered data from database.
Still not working
Am getting error:
Its just displaying all data from db not by filtered query
<form action="search.php" method="POST">
<div class="md-form">
<select class="mdb-select" name="state_search" required>
<option disabled selected>Choose your State</option>
<option name="state" value="Abia State">Abia State</option>
<option name="state" value="Adamawa State">Adamawa State</option>
<option name="state" value="Anambra State">Anambra State</option>
</select>
</div>
<div class="col-lg-4">
<div class="md-form">
<select class="mdb-select" name="school_search">
<option value="" disabled selected>Choose your School</option>
<option value="Michael Opkara University">Mouau</option>
<option value="University of Benin">UniBen</option>
<option value="University of Porthacourt">UniPort</option>
</select>
</div>
<button type="submit" class="btn purple-gradient btn-lg" name="filter">Search <i class="fa fa-paper-plane-o ml-1"></i></button>
</div>
</form>
PHP
<?php
$school_search = $connect->real_escape_string($_POST["school_search"]);
$state_search = $connect->real_escape_string($_POST["state_search"]);
$query = mysqli_query($connect, "SELECT * FROM roomate WHERE (`state` LIKE '%".$state_search."%') OR (`school` LIKE '%".$school_search."%')") or die(mysql_error());
if($query){
while($row = mysqli_fetch_array($query)){
?>
<div class="container" style="padding-top:70px;">
<!--Grid row-->
<div class="row">
<?php
foreach ($query as $user) {?>
<div class="col-lg-4 col-md-12 mb-r">
<!--Featured image-->
<div class="overlay hm-white-slight z-depth-1-half mb-2">
<img src="<?php echo $user['room_avatar']?>" class="img-fluid" alt="avatar image">
<a><div class="mask"></div></a>
</div>
<!--Excerpt-->
<a href="" class="pink-text">
<h6>
<i class="fa fa-map"></i><strong><?php echo $user['city'];?>, <?php echo $user['state'];?></strong><br>
<small><?php echo $user['school'];?></small>
</h6>
</a>
<h4><?php echo $user['type'];?></h4>
<p>
by <a><strong><?php echo $user['room_name'];?></strong></a>
<?php echo $user['created'];?>
</p>
<label class="badge badge-danger"> non-verified </label>
<a href="contact.php">
<label class="badge badge-primary">Report Scam</label>
</a>
<p><?php echo $user['discription'];?></p>
<a class="btn btn-pink btn-rounded">Contact <?php echo $user['room_name'];?></a>
</div>
<?php
} ?>
</div>
</div>
<?php
}
}
else{
echo(mysql_error());
}
?>
Need help making this work out
The name of your select needs to match the $_POST variable key.
So in your case your <select> need the name state_search.
or change your $_POST search to $_POST['state'] to match your select name.
also you should use the $state_search variable in your query instead of $query.
You may have more issues , just pay attention to details.
You put to much HTML in echo function.
<?php
$school_search = $connect->real_escape_string($_POST["school_search"]);
$state_search = $connect->real_escape_string($_POST["state_search"]);
$query = mysqli_query($connect, "SELECT * FROM roomate WHERE (`room_name` LIKE '%".$query."%') OR (`discription` LIKE '%".$query."%') OR (`discription` LIKE '%".$query."%') OR (`type` LIKE '%".$query."%')") or die(mysql_error());;
$result = mysqli_query($connect, $query);
if($result){
while($row = mysqli_fetch_array($result)){
?>
<div class="container" style="padding-top:70px;">
<!--Grid row-->
<div class="row">
<?php
foreach ($query as $user) {?>
<div class="col-lg-4 col-md-12 mb-r">
<!--Featured image-->
<div class="overlay hm-white-slight z-depth-1-half mb-2">
<img src="<?php echo $user['room_avatar']?>" class="img-fluid" alt="avatar image">
<a><div class="mask"></div></a>
</div>
<!--Excerpt-->
<a href="" class="pink-text">
<h6>
<i class="fa fa-map"></i><strong><?php echo $user['city'];?>, <?php echo $user['state'];?></strong><br>
<small><?php echo $user['school'];?></small>
</h6>
</a>
<h4><?php echo $user['type'];?></h4>
<p>
by <a><strong><?php echo $user['room_name'];?></strong></a>
<?php echo $user['created'];?>
</p>
<label class="badge badge-danger"> non-verified </label>
<a href="contact.php">
<label class="badge badge-primary">Report Scam</label>
</a>
<p><?php echo $user['discription'];?></p>
<a class="btn btn-pink btn-rounded">Contact <?php echo $user['room_name'];?></a>
</div>
<?php
} ?>
</div>
</div>
<?php
}
}
else{
echo(mysql_error());
}

Filter query results with checkboxes [PHP] [MYSQL]

In my site there is a page where is shown the content of my database (the list of all the locals). I would like to let the user filter the research, so I would like that my query that show the resoults can be modified by checkboxes. If a user select Vegan in the checkbox, the page must show only vegan locals. I don't have a form for the checkboxes so I don't know hot to handle the input.
I have two scripts: locals_page.php that is the main page with the filter boxes and table_generator.php that is a php script that do the query and retrieve the data, and show them into locals_page.php
I searched a lot to resolve this but I don't know how to start because I don't have a simple table for the resoults or a common form.
Maybe it's a generic question, but an help will be appreciated.
locals_page
<body>
<div class="container">
<div class="row">
<!--FILTERS PART-->
<div class="col-sm-3 col-md-3">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne"><span class="glyphicon glyphicon-folder-close">
</span>Kitchen type</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
<table class="table">
<tr>
<td>
<input type="checkbox" name="Kebab" value="Kebab"> Kebab
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="Asiatic" value="Asiatic"> Asiatic
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="Vegan" value="Vegan"> Vegan
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo"><span class="glyphicon glyphicon-th">
</span>Local Type</a>
</h4>
</div>
<div id="collapseTwo" class="panel-collapse collapse">
<div class="panel-body">
<table class="table">
<tr>
<td>
<input type="checkbox" name="Restaurant" value="Restaurant"> Restaurant
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="Pub" value="Pub"> Pub
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<!--END FILTERS PART-->
<div class="col-sm-9 col-md-9">
<!--SCRIPT THAT GENERATE MY PAGE-->
<?php require_once('php\table_generator.php'); ?>
</div>
</div>
</div>
</body>
table_generator
<?php
echo '<section class="col-xs-12 col-sm-6 col-md-12">';
$sql = "SELECT nome_L, tipocucina_TC, wifi_L, tipolocale_TL, descrizione_L, indirizzo_L, fasciaprezzo_L, convenzione_L FROM locale l
JOIN tipocucina c On l.TipoCucina_L = c.IDtipocucina_TC
JOIN tipolocale t On l.TipoLocale_L = t.IDTipolocale_TL";
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
while ($row = mysqli_fetch_array($result)) {
$nome_Local = $row['nome_L'];
$descrizione_Local = $row['descrizione_L'];
$indirizzo_Local = $row['indirizzo_L'];
$tipocucina_Local = $row['tipocucina_TC'];
$tipolocale_Local = $row['tipolocale_TL'];
$wifi_Local = $row['wifi_L'];
$prezzo_Local = $row['fasciaprezzo_L'];
//Inizio article
echo '<article class="search-result row">
<div class="col-xs-12 col-sm-12 col-md-3">
<a class="thumbnail"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/e6/Piadina.jpg/1200px-Piadina.jpg" alt="Lorem ipsum" /></a>
</div>
<div class="col-xs-12 col-sm-12 col-md-2" style="width: 18%;">
<ul class="meta-search">
<li><i class="fa fa-cutlery fa-lg"></i> <span>' . $tipocucina_Local . '</span></li>
<li><i class="fa fa-coffee fa-lg"></i> <span>' . $tipolocale_Local . '</span></li>
<li><i class="fa fa-coffee fa-lg"></i> <span>' . $wifi_Local . '</span></li>
<li><i class="fa fa-coffee fa-lg"></i> <span>' . $prezzo_Local . '</span></li>
</ul>
</div>
<div class="col-xs-12 col-sm-12 col-md-7 excerpet" style="width: 55%;">';
echo "<h3><a>" . $nome_Local . "</a></h3>";
echo '<i class="fa fa-compass"> </i>' . $indirizzo_Local . '</i>';
echo "<br>";
echo '<p class="local-description">' . $descrizione_Local . '</p>';
echo '
</div>
<span class="clearfix borda"></span>
</article>'; //Fine article
}
$conn->close();
echo "</section>";
?>
I don't know if javascript or ajax or jquery is needed. I don't ever know how to start. I hope my problem is understandable and that the code I put is helpful. Thank you so much in advice.

Categories