.php files working on localhost but not on webserver - php

I've created some kind of webshop for my highschool project. After building a filter system that searches through my database and loads them with the help of my self-written class product loader.
To set the filtervariables I've worked with $_GET. Everything is working perfectly fine on my localhost but when uploading to the server posed by my highschool only the header which I'm "requiring" separately works but anything else won't load.
Might it be that the server doesn't allow $_GET methods?
<?php
$current_page = 'Webshop.php';
require 'header.php';
require 'includes\productloader.inc.php';
?>
<body>
<form method="get"action="Webshop.php">
<aside class="EDside">
<div class="Filtersidebar">
<h1>Filter</h1>
<ul class="Filter">
<li><a>Max. Höhe</a></li>
<li><a>Max. Breite</a></li>
<li><a>Max. Tiefe</a></li>
<li><a>Metallart</a></li>
<li><a>Max. Preis</a></li>
<li><input type="text" name="Höhe" value=""></li>
<li><input type="text" name="Breite" value=""></li>
<li><input type="text" name="Tiefe" value=""></li>
<li><select id="Metallart" name="Metallart">
<option value=""></option>
<option value="Bronze">Bronze</option>
<option value="Messing">Messing</option>
<option value="Kupfer">Kupfer</option>
<option value="Edelstahl">Edelstahl</option>
<option value="Aluminium">Aluminium</option>
<option value="Rostig">Rostig</option>
</select></li>
<li><input type="text" name="Preis" value=""></li>
</ul>
</div>
<div>
<a href = Webshop.php><button>Zurücksetzen</button></a>
<button type ="submit" >Anwenden</button>
</div>
</aside>
</form>
<?php
if(isset($_GET['Höhe'])){
$maxhöhe;
if(!$_GET['Höhe']=="")
$maxhöhe = $_GET['Höhe'];
else
$maxhöhe = null;
if(!$_GET['Breite']=="")
$maxbreite = $_GET['Breite'];
else
$maxbreite = null;
if(!$_GET['Tiefe']=="")
$maxtiefe = $_GET['Tiefe'];
else
$maxtiefe = null;
$metallart;
if(!$_GET['Metallart']=="")
$metallart = $_GET['Metallart'];
else
$metallart = null;
$maxpreis;
if(!$_GET['Preis']=="")
$maxpreis = $_GET['Preis'];
else
$maxpreis = null;
if($maxhöhe == null && $maxbreite == null && $maxtiefe == null && $metallart == null && $maxpreis == null)
$loader = productloader::withoutstatement();
else
$loader = productloader::withstatement($maxhöhe,$maxbreite,$maxtiefe,$metallart,$maxpreis);
}
else
$loader = productloader::withoutstatement();
$productcount = count($loader->products);
?>
<?php
if($productcount>0){
echo '
<section class="EDSection">
<ul class="Skulptur">
<li> <div class = "SBox">
<div class="angebote">
<div class="angebot-bild">
<img class="a01" src="showimage.php?id='.$loader->products[0]->imgid.'" />
</div>
<div class="angebot-text">
<h1>'.$loader->products[0]->productname.'</h1>
</div>
<div class="angebot-preis">
<p>'.$loader->products[0]->preis.' EUR</p>
</div>
</div>
</div>
</li>
';
}
if($productcount>1){
echo '
<li><div class = "SBox">
<div class="angebote">
<div class="angebot-bild">
<img class="a01" src="showimage.php?id='.$loader->products[1]->imgid.'" />
</div>
<div class="angebot-text">
<h1>'.$loader->products[1]->productname.'</h1>
</div>
<div class="angebot-preis">
<p>'.$loader->products[1]->preis.' EUR</p>
</div>
</div>
</div>
</li>
';
}
if($productcount>2){
echo '
<li><div class = "SBox">
<div class="angebote">
<div class="angebot-bild">
<img class="a01" src="showimage.php?id='.$loader->products[2]->imgid.'" />
</div>
<div class="angebot-text">
<h1>'.$loader->products[2]->productname.'</h1>
</div>
<div class="angebot-preis">
<p>'.$loader->products[2]->preis.' EUR</p>
</div>
</div>
</div>
</li>
';
}
if($productcount>3){
echo '
<li><div class = "SBox">
<div class="angebote">
<div class="angebot-bild">
<img class="a01" src="showimage.php?id='.$loader->products[3]->imgid.'" />
</div>
<div class="angebot-text">
<h1>'.$loader->products[3]->productname.'</h1>
</div>
<div class="angebot-preis">
<p>'.$loader->products[3]->preis.' EUR</p>
</div>
</div>
</div>
</li>
';
}
if($productcount>4){
echo'
<li> <div class = "SBox">
<div class="angebote">
<div class="angebot-bild">
<img class="a01" src="showimage.php?id='.$loader->products[4]->imgid.'" />
</div>
<div class="angebot-text">
<h1>'.$loader->products[4]->productname.'</h1>
</div>
<div class="angebot-preis">
<p>'.$loader->products[4]->preis.' EUR</p>
</div>
</div>
</div>
</li>
';
}
if($productcount>5){
echo ' <li><div class = "SBox">
<div class="angebote">
<div class="angebot-bild">
<img class="a01" src="showimage.php?id='.$loader->products[5]->imgid.'" />
</div>
<div class="angebot-text">
<h1>'.$loader->products[5]->productname.'</h1>
</div>
<div class="angebot-preis">
<p>'.$loader->products[5]->preis.' EUR</p>
</div>
</div>
</div>
</li>';
}
if($productcount>6){
echo ' <li><div class = "SBox">
<div class="angebote">
<div class="angebot-bild">
<img class="a01" src="showimage.php?id='.$loader->products[6]->imgid.'" />
</div>
<div class="angebot-text">
<h1>'.$loader->products[6]->productname.'</h1>
</div>
<div class="angebot-preis">
<p>'.$loader->products[6]->preis.' EUR</p>
</div>
</div>
</div>
</li>';
}
if($productcount>7){
echo ' <li><div class = "SBox">
<div class="angebote">
<div class="angebot-bild">
<img class="a01" src="showimage.php?id='.$loader->products[7]->imgid.'" />
</div>
<div class="angebot-text">
<h1>'.$loader->products[7]->productname.'</h1>
</div>
<div class="angebot-preis">
<p>'.$loader->products[7]->preis.' EUR</p>
</div>
</div>
</div>
</li>';
}
?>
</section>
<section>
<div style="text-align: center">
<ul class="pagination">
<li>«</li>
<li><a class="active" href="Webshop.php">1</a></li>
<li>2</li>
<li>3</li>
<li>»</li>
</ul>
</div>
</section>
<?php
require 'footer.php';
?>
</body>
</html>

Related

The footer of my website's homepage isn't coming

I have been trying to make a website. It is an online shopping website.
This is my code-
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Books And Beyond</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Bootstrap styles open source -->
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" crossorigin="anonymus">
<!-- Customize styles -->
<link href="style.css" rel="stylesheet"/>
<!-- font awesome styles open source -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" crossorigin="anonymus">
<!-- Favicons -->
<link rel="shortcut icon" href="/favicon.ico">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style
type="text/css">
<!--
body {
background-image: url(assets/img/background.jpg);
}
-->
</style></head>
<body>
<!--
Upper Header Section
-->
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="topNav">
<div class="container">
<div class="alignR">
<?php if (isset($_SESSION['email'])) { echo $_SESSION['email']; } else { ?>
<ul class="nav pull-right">
<li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="#"><span class="icon-lock"></span> Login <b class="caret"></b></a>
<div class="dropdown-menu">
<form class="form-horizontal loginFrm" action="checkuser.php" method="post">
<div class="control-group">
<input name="email" type="text" class="span2" id="email" placeholder="Email">
</div>
<div class="control-group">
<input name="password" type="password" class="span2" id="password" placeholder="Password">
</div>
<div class="control-group">
<label class="checkbox">
<input type="checkbox"> Remember me
</label>
<button name="login" type="submit" class="shopBtn btn-block">Sign in</button>
</div>
</form>
</div>
</li>
</ul>
<?php } ?>
<?php if (isset($_SESSION['email'])) { ?>
Logout
<?php } else { ?>
<span class="icon-edit"></span> Register
<?php }?>
</div>
</div>
</div>
</div>
<!--
Lower Header Section
-->
<div class="container">
<div id="gototop"> </div>
<header id="header">
<div class="row">
<div class="span4">
<h1>
<a class="logo" href="index.php"><span>Books And Beyond</span>
<img src="assets/img/logo1.jpg" alt="" width="218" height="94"> </a> </h1>
</div>
</div>
</header>
<!--
Navigation Bar Section
-->
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<div class="nav-collapse">
<ul class="nav">
<li class="active">Home</li>
<li class="">About</li>
<li class="">Bargain Books</li>
<li class="">New Releases</li>
<li class="">Bestsellers</li>
<li class="">Contact Us</li>
</ul>
<ul class="nav pull-right">
</ul>
</div>
</div>
</div>
</div>
<div class="row">
<div class="span12">
<img src="assets/img/banner.jpg"/>
<hr class="soften"/>
</div>
</div>
<!--Body Section
-->
<div class="row">
<div id="sidebar" class="span3">
<div class="well well-small">
<h3> Category </h3>
<ul class="nav nav-list">
<li><span class="icon-chevron-right"></span>Fiction</li>
<li><span class="icon-chevron-right"></span>Non-Fiction</li>
<li><span class="icon-chevron-right"></span>Young Adult</li>
<li><span class="icon-chevron-right"></span>Children's</li>
<li><span class="icon-chevron-right"></span>Travel</li>
<li><span class="icon-chevron-right"></span>Education</li>
<li style="border:0"> </li>
</ul>
</div>
<!--<div class="well well-small alert alert-warning cntr">
<h2>50% Discount</h2>
<p>
only valid for online order. <br><br><a class="defaultBtn" href="#">Click here </a>
</p>
</div>-->
<!-- <div class="well well-small" ><img src="assets/img/paypal.jpg" alt="payment method paypal"></div>-->
<!--<a class="shopBtn btn-block" href="#">Upcoming products <br><small>Click to view</small></a>-->
<ul class="nav nav-list promowrapper">
<?php
/* require_once('dbconnect.php'); */
$result = mysql_query("SELECT * from product WHERE brand='accessories'");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
$price=$row["productprice"];
$productimage=$row["productimage"];
?>
<li>
<div class="thumbnail">
<img width="200" height="80" src="getImage.php?intproductid=<?php print $intproductid;?>" />
<div class="caption">
<table width="250" border="0">
<tr>
<td align="left" valign="middle"><form action="product_detail.php" method="post" name="form2" id="form2">
<label>
<input type="hidden" name="intproductid2" value="<?php echo $intproductid; ?>" />
<input name="Submit2" type="submit" class="shopBtn" value="View" />
</label>
</form></td>
<td align="right" valign="middle"><h4> <span class="pull-right"><?php echo $price; ?>.00</span></h4></td>
</tr>
</table>
</div>
</div>
</li>
<li style="border:0"> </li>
<?php } ?>
</ul>
</div>
<div class="span9">
<!--
New Products
-->
<div class="well well-small">
<h3>New Products </h3>
<hr class="soften"/>
<div class="row-fluid">
<div id="newProductcar" class="carousel slide">
<div class="">
<div class="item active">
<ul class="thumbnails">
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='bousni' LIMIT 1");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
//$productimage=$row["productimage"];
?>
<li class="span3">
<div class="thumbnail">
<img width="200" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
</div>
</li>
<?php } ?>
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='hela couture' LIMIT 1");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
//$productimage=$row["productimage"];
?>
<li class="span3">
<div class="thumbnail">
<img width="200" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
</div>
</li>
<?php } ?>
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='zey' LIMIT 1");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
//$productimage=$row["productimage"];
?>
<li class="span3">
<div class="thumbnail">
<img width="200" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
</div>
</li>
<?php } ?>
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='AL-JUMAIRA' LIMIT 1");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
//$productimage=$row["productimage"];
?>
<li class="span3">
<div class="thumbnail">
<img width="200" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
</div>
</li>
<?php } ?>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="well well-small">
<div class="span8">
<div class="row-fluid">
<h3>Features Products </h3>
<hr class="soften"/>
<ul class="thumbnails">
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='roza' LIMIT 3");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
$productname=$row["productname"];
$brand=$row["brand"];
$price=$row["productprice"];
$productimage=$row["productimage"];
?>
<li class="span4">
<div class="thumbnail">
<img width="250" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
<div class="caption cntr">
<p style="color:#990033"><?php echo $productname; ?></p>
<p><?php echo $brand; ?></p>
<p><strong>SAR <?php echo $price; ?>.00</strong></p>
<div class="btn-group">
<form id="form2" name="form2" method="post" action="product_detail.php">
<label>
<input type="hidden" name="intproductid2" value="<?php echo $intproductid; ?>" />
<input name="Submit2" type="submit" class="shopBtn" value="View" />
<input name="Submit2" type="submit" class="defaultBtn" value="Add to cart" />
</label>
</form>
</div>
<br class="clr">
</div>
</div>
</li>
<?php } ?>
</ul>
<hr class="soften"/>
<ul class="thumbnails">
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='haya' LIMIT 3");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
$productname=$row["productname"];
$brand=$row["brand"];
$price=$row["productprice"];
$productimage=$row["productimage"];
?>
<li class="span4">
<div class="thumbnail">
<img width="250" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
<div class="caption cntr">
<p style="color:#990033"><?php echo $productname; ?></p>
<p><?php echo $brand; ?></p>
<p><strong>SAR <?php echo $price; ?>.00</strong></p>
<div class="btn-group">
<form id="form2" name="form2" method="post" action="product_detail.php">
<label>
<input type="hidden" name="intproductid2" value="<?php echo $intproductid; ?>" />
<input name="Submit2" type="submit" class="shopBtn" value="View" />
<input name="Submit2" type="submit" class="defaultBtn" value="Add to cart" />
</label>
</form>
</div>
<br class="clr">
</div>
</div>
</li>
<?php } ?>
</ul>
</div>
</div>
<div class="row">
</div>
</div>
</div></div></div>
<!--
Footer
-->
<footer class="footer" style="float: bottom;">
<div class="row-fluid">
<div class="span3">
<h5>ORDER SUPPORT</h5>
Store pickup<br>
Return and Refund<br>
</div>
<div class="span3">
<h5>PRODUCT SUPPORT</h5>
FAQs<br>
Inquiry<br>
</div>
<div class="span3">
<h5>COOPORATIVE INFO</h5>
Terms and Condition <br>
Contact us<br>
</div>
<div class="span3">
<h5>GET CONNECTED</h5>
About us <br>
Create Account<br>
</div>
</div>
</footer>
</div><!-- /container -->
<div class="copyright">
<div class="container">
<p class="pull-right"> </p>
<span>Copyright 2019, Fatimatuz Johura - s201403034- Jeddah (Ladies Branch);<br> Books And Beyond</span>
</div>
</div>
<script src="assets/js/jquery.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/jquery.easing-1.3.min.js"></script>
<script src="assets/js/jquery.scrollTo-1.4.3.1-min.js"></script>
<script src="assets/js/shop.js"></script>
</body>
</html>
The 'New Products' and the footer section is not coming and I cant figure out why. I dont have a webhost yet so I am using localhost for now. I have tried editing the code but whatever I do, it does not seem to work. If anyone can help, I would really appreciate it. Thank you.
On line 152 (new products is on line ~ 185[ish])
/* require_once('dbconnect.php'); */
$result = mysql_query("SELECT * from product WHERE brand='accessories'");
As I said in the comments you use this require_once('dbconnect.php'); multiple times when it should be only once at the top of your file.
The above code is the first occurrence I could find, and as it's commented out, that query is going to bomb out on you. Execution happens top to bottom and the first uncommitted occurrence of that is line 196[ish], which is way to late for that first query.
Also as I said in the comments
Try turning on Error reporting - error_reporting(-1); and ini_set('display_errors', '1'); put those right after the <?php tag
You can save yourself, and us a lot of time that way.
So in Summery,
Remove all of these require_once('dbconnect.php'); and then add just one after the opening <?php tag.
PS you can easily test this, by just commenting that first query out, or by uncommenting that first require_once.

Hi, i want to limit flexi slider images in loop, by fetching from database, my project is in codeignitor

<div class="content-bottom-in">
<ul id="flexiselDemo1">
<?php $tg = $this->db->get_where("mobile_accessories",array("acs_category"=>"Tempered_glass","product_status"=>1))->result();
foreach($tg as $g){
?>
<li>
<div class="w3l-specilamk">
<div class="speioffer-agile">
<a href="#">
<img src="<?php echo ($g->accessories_image!='')?base_url().$g->accessories_image:base_url()."img/doc/no_image.jpg";?>" width="160px;" height="160px;" alt="">
</a>
</div>
<div class="product-name-w3l">
<h4 style="text-align:center">
<?php echo $g->accessories_name ?>
</h4>
<div class="w3l-pricehkj" style="padding-left:50px">
<span class="item_price"><i class="fa fa-inr" aria-hidden="true"></i> <?php echo $g->accessories_discount_price ?></span><br>
<del><i class="fa fa-inr" aria-hidden="true"></i><?php echo $g->accessories_actual_price ?></del>
</div>
<div class="snipcart-details top_brand_home_details item_add single-item hvr-outline-out">
<form action="#" method="post">
<fieldset>
<input name="submit" value="Add to cart" class="button"/>
</fieldset>
</form>
</div>
</div>
</div>
</li>
<?php } ?>
</ul>
</div>

getting id from url

how can i get the id passed with the url and save it in an input ? and the controller is like that :
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use URL;
use DB;
class productController extends Controller
{
//
public function getIndex(){
$in=URL::get('id');
$product=DB::table('products')->get(['id','name','salary','sale','p_salary','n_salary','best','type','image_name','category_id','sub_id','incategory_id','new']);
return view('contents.products')->with('product',$product)
->with('in',$in);
}
}
and the view is like that :
#extends('master')
#section('content')
<form method="POST" action="{{action('productController#getIndex')}}" enctype="multipart/form-code">
{!! csrf_field() !!}
<div class="em-wrapper-main">
<div class="container container-main">
<div class="em-inner-main">
<div class="em-wrapper-area02"></div>
<div class="em-wrapper-area03"></div>
<div class="em-wrapper-area04"></div>
<div class="em-main-container em-col1-layout">
<div class="row">
<div class="em-col-main col-sm-24">
<div class="page-title category-title">
<h1>Shoes</h1>
</div>
<div class="category-products">
<div class="toolbar-top">
<div class="toolbar">
<div class="pager">
<p class="amount"> Items 1 to 12 of 20 total</p>
<div class="pages">
<ol>
<li class="current">1</li>
<li>2
</li>
<li>
<a class="next i-next" href="#" title="Next"> <img src="{{asset('assets/images/pager_arrow_right.gif')}}" alt="Next" class="v-middle" /> </a>
</li>
</ol>
</div>
</div><!-- /.pager -->
<div class="sorter">
<p class="view-mode">
<label>View as:</label> <strong title="Grid" class="grid">Grid</strong> List
</p>
<div class="sort-by toolbar-switch">
<div class="toolbar-title">
<label>Sort By</label>
<select class="sortby" name="sortby">
<option value="position" selected="selected"> Position</option>
<option value="name"> Name</option>
<option value="price"> Price</option>
</select>
</div>
<a href="#" title="Set Descending Direction"><img src="{{asset('assets/images/i_asc_arrow.png')}}" alt="Set Descending Direction" class="v-middle" />
</a>
</div>
<div class="limiter toolbar-switch">
<div class="toolbar-title">
<label>Show</label>
<select class="toolbar-show">
<option value="12" selected="selected"> 12</option>
<option value="24"> 24</option>
<option value="36"> 36</option>
</select>
</div>
</div>
</div><!-- /.sorter -->
</div>
</div><!-- /.toolbar-top -->
<div id="em-grid-mode">
<ul class="emcatalog-grid-mode products-grid emcatalog-disable-hover-below-mobile">
#foreach($product as $p)
#foreach($in as $n)
#if($p->incategory_id == $n->id)
<li class="item first">
<div class="product-item">
<div class="product-shop-top">
<a href="{{action('productdetailController#getProduct' , array('id' => $p->id))}}" title="{{$p->name}}" class="product-image">
<img class="em-img-lazy img-responsive em-alt-hover" src="{{asset('images/')}}/{{$p->image_name}}" width="220" height="220" alt="WIASSI Version 1" />
<img id="product-collection-image-206" class="em-img-lazy img-responsive em-alt-org" src="{{asset('images/')}}/{{$p->image_name}}" width="220" height="220" alt="WIASSI Version 1" />
<span class="bkg-hover"></span> </a>
<div class="bottom">
<div class="em-btn-addto text-center ">
<button type="button" title="Add to Cart" class="button btn-cart" onclick="206"><span><span>Add to Cart</span></span>
</button>
<ul class="add-to-links">
<li><button type="submit" class="link-wishlist" name="submit" title="Add to Wishlist">Add to Wishlist</button>
</li>
<li>Add to Compare
</li>
</ul>
</div>
<div class="quickshop-link-container"> Quickshop
</div>
</div>
</div>
<div class="product-shop">
<div class="f-fix">
<h2 class="product-name text-center "> {{$p->name}} </h2>
<div class=" text-center">
<div class="ratings">
<div class="rating-box">
<div class="rating" style="width:%"></div>
</div> <span class="amount">(0)</span>
</div>
</div>
<div class="text-center ">
<div class="price-box"> <span class="regular-price" id="product-price-206"> <span class="price" content="{{$p->salary}}">${{$p->salary}}</span> </span>
</div>
</div>
<div class="desc std text-center em-element-display-hover">{{$p->name}}</div>
</div>
</div>
</div><!-- /.product-item -->
</li>
#endif
#endforeach
#endforeach
</ul>
</div><!-- /.em-grid-mode -->
<div class="toolbar-bottom em-box-03">
<div class="toolbar">
<div class="pager">
<p class="amount"> Items 1 to 12 of 20 total</p>
<div class="pages">
<ol>
<li class="current">1</li>
<li>2
</li>
<li>
<a class="next i-next" href="#" title="Next">
<img src="{{asset('assets/images/pager_arrow_right.gif')}}" alt="Next" class="v-middle" /> </a>
</li>
</ol>
</div>
</div><!-- /.pager -->
<div class="sorter">
<p class="view-mode">
<label>View as:</label> <strong title="Grid" class="grid">Grid</strong> List
</p>
<div class="sort-by toolbar-switch">
<div class="toolbar-title">
<label>Sort By</label>
<select class="sortby" name="sortby">
<option value="position" selected="selected"> Position</option>
<option value="name"> Name</option>
<option value="price"> Price</option>
</select>
</div>
<a href="#" title="Set Descending Direction"><img src="{{asset('assets/images/i_asc_arrow.png')}}" alt="Set Descending Direction" class="v-middle" />
</a>
</div>
<div class="limiter toolbar-switch">
<div class="toolbar-title">
<label>Show</label>
<select class="toolbar-show">
<option value="12" selected="selected"> 12</option>
<option value="24"> 24</option>
<option value="36"> 36</option>
</select>
</div>
</div>
</div><!-- /.sorter -->
</div>
</div><!-- /.toolbar-bottom -->
</div><!-- /.category-products -->
</div>
</div>
</div><!-- /.em-main-container -->
</div>
</div>
</div><!-- /.em-wrapper-main -->
</form>
#stop
how to get the products that have the incategory_id passed with the url ?
You could use the Request facade to get the id and then, use the where method to get the requested product like this:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Request;
use DB;
class productController extends Controller
{
public function getIndex()
{
$in=Request::get('id');
$product=DB::table('products')->where('incategory_id', $in)->get(['id','name','salary','sale','p_salary','n_salary','best','type','image_name','category_id','sub_id','incategory_id','new']);
return view('contents.products')->with('product',$product);
}
}
Also, you could type-hint the Illuminate\Http\Request:
public function getIndex(Request $request)
{
$in=$request->get('id');
// ...
}

Zend - dynamic pages

I have a video as background so I want only the content of the page to load since everything else is the same. I tried using Ajax, but I couldn't get it to work. Is there a way to achieve that ?
Layout code:
/...
<body>
<video autoplay loop poster="/img/bg-still.png" preload="auto" id="bg">
<source src="/img/bg.webm" type="video/webm">
</video>
<div id="wrapper">
<header>
<div class="top_line">
<div class="container">
<div class="row">
<?php
if ($user = $this->identity()) {
?>
<div class="col-lg-6 pull-left">
<p>
<span class="welcome-show">Здравей, <?php echo $this->EscapeHtml($user->nick) ?></span>
<span class="rank">Ранк:
<?php
switch ($user->role) {
case 1:
?> <span class="rank-vip">VIP</span> <?php
break;
case 2:
?> <span class="rank-vipplus">VIP+</span> <?php
break;
default:
?> <span class="rank-none">Никакъв</span> <?php
break;
}
?>
</span>
<span class="credits-show">Кредити: <?php echo $this->EscapeHtml($user->credits) ?></span>
<img src="/img/ui-icon-credits" class="ui-icon-credits"/>Заредете кредити
<a href="/edit" class="register"><span
class="icon icon-settings ui-icon ui-icon-gear"></span>Настройки</a>
<a href="/logout" class="register"><span
class="icon icon-logout ui-icon ui-icon-close"></span>Излез</a>
</p>
</div>
<?php
} else {
?>
<div class="col-lg-6 pull-left">
<p>
<span class="icon icon-login ui-icon ui-icon-key"></span>Влез
<a href="/register" class="register"><span
class="icon icon-register ui-icon ui-icon-person"></span>Регистрирай се</a>
</p>
</div>
<?php
}
?>
</div>
</div>
</div>
</header>
<div class="page_head">
<div class="nav-container" style="height: auto;">
<nav>
<div class="container">
<div class="row">
<div class="col-lg-3 pull-left">
<a href="/">
<div class="logo"></div>
</a>
<div class="beta">BETA</div>
</div>
<div class="col-lg-9 pull-right">
<div class="menu">
<div id="dl-menu" class="dl-menuwrapper">
<button class="dl-trigger">Open Menu</button>
<?php
echo $this->navigation('navigation')->menu();
?>
</div>
</div>
</div>
</div>
</div>
</nav>
</div>
</div>
<div class="content" id="content">
<?php echo $this->content; ?>
</div>
<div class="footer">
/...

dropdown is not selecting selected option in php while editing

i'm selecting option while adding,but selected option is not in edit dropdown.What will be the issue?
Edit Appointment.php:
<?php
include_once 'config.php';
$id = $_REQUEST['id'];
$query="SELECT p.*,u.fileno FROM patients AS p,users AS u WHERE p.id_patient='$id' AND p.users_id_user=u.id_user";
$resultPatient=$db->select($query);
if(isset($_POST['requesttype'])&&$_POST['requesttype'] == 'editPatient'){
$updateInfo=array();
$updateInfo['name'] = $_REQUEST['name'];
$updateInfo['email'] = $_REQUEST['email'];
$updateInfo['age'] = $_REQUEST['age'];
/*$updateInfo['age'] = $_REQUEST['age'];
$updateInfo['gender'] = $_REQUEST['gender'];*/
$updateInfo['phone'] = str_replace(array('(',')',' ','-'), array('','','',''),$_REQUEST['phone']);
$updateInfo['date'] = date('d-m-Y', strtotime($_REQUEST['date']));
$updateInfo['time'] = $_REQUEST['time'];
$updateInfo['confirm_status'] = 'c';
$date=date('Y-m-d H:i:s');
$updateInfo['date_updated']=$date;
$updateCondition=" id_patient='".$id."'";
$res=$db->update('patients', $updateInfo,$updateCondition);
$id=$resultPatient[0]['users_id_user'];
$where="t.users_id_user='$id' AND";
$query="SELECT t.device_id,t.platforms_id_platform as id_platform FROM tokens as t WHERE $where t.device_id!=''";
$resultTokens=$db->select($query);
if($resultTokens)
{
include_once 'Gcm.php';
include_once 'Apns.php';
$deviceTokens=array();
$deviceTokens1=array();
$alert='Your appointment is confirmed on '.$updateInfo['date'].' at '.$updateInfo['time'];
foreach($resultTokens as $token)
{
if($token['id_platform']=='1'&&$token['device_id']!='')
$deviceTokens[]=$token['device_id'];
if($token['id_platform']=='2'&&$token['device_id']!='')
$deviceTokens1[]=$token['device_id'];
}
if(count($deviceTokens)>0)
{
$apns=new Apns();
$apns->apnsPush($deviceTokens,$alert);
}
if(count($deviceTokens1)>0)
{
$gcm = new GCM();
$message = array("m" => $alert);
$result = $gcm->send_notification($deviceTokens1,$message);
}
}
header("Location:appointments.php?m=u");
}
$querySlot = "SELECT * FROM slots";
$resultSlot=$db->select($querySlot);
$query="select * from photos where type='service'";
$resultUsers1=$db->select($query);
include_once 'header.php';
?>
<script type="text/javascript" src="js/jquery.timepicker.js"></script>
<link rel="stylesheet" type="text/css" href="js/jquery.timepicker.css" />
<script>
$(function() {
$('#basicExample').timepicker();
});
</script>
<!-- Sidebar begins -->
<div id="sidebar">
<!-- Left Main menu begins -->
<?php include_once 'menu.php'; ?>
<!-- Left Main menu ends -->
<!-- Secondary nav -->
<div class="secNav">
<div class="secWrapper">
<!--div class="secTop">
</div-->
<!-- Tabs container -->
<div id="tab-container" class="tab-container">
<div id="general">
<!-- Sidebar big buttons -->
<div id="general" style="display: block;" class="active">
<ul class="subNav">
<li><span class="icos-images2"></span>Add Appointment</li>
<li class="activeli"><span class="icos-images2"></span>View/Edit Appointments</li>
<li><span class="icos-images2"></span>Appointments History</li>
<li><span class="icos-images2"></span>View/Edit Reminder Settings</li>
<li><span class="icos-images2"></span>Add Reminder Settings</li>
<li><span class="icos-images2"></span>View/Edit Medicine Reminder Settings</li>
<li><span class="icos-images2"></span>Add Medicine Reminder Settings</li>
</ul>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<!-- Sidebar ends -->
<!-- Content begins -->
<div id="content">
<div class="contentTop">
<span class="pageTitle"><span class="icon-screen"></span>Edit Appointment</span>
<div class="clear"></div>
</div>
<!-- Breadcrumbs line -->
<div class="breadLine">
<div class="bc">
<ul id="breadcrumbs" class="breadcrumbs">
<li>Dashboard</li>
<li>Appointments</li>
<li class="current">Edit Appointment</li>
</ul>
</div>
</div>
<!-- Main content -->
<div class="wrapper">
<div class="fluid">
<form name="formEditAppointment" id="usualValidate" class="main" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data">
<div class="widget grid6 chartWrapper" style="width:100%;min-height:550px;">
<div class="whead"><h6>Edit Appointment Information</h6><div class="clear"></div></div>
<div class="formRow">
<div class="grid3"><label>File No:<span class="req">*</span></label></div>
<div class="grid9"><?php echo stripslashes($resultPatient[0]['fileno']);?></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Name:<span class="req">*</span></label></div>
<div class="grid9"><input type="text" class="required" name="name" id="name" value="<?php echo stripslashes($resultPatient[0]['name']);?>"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Email:</label></div>
<div class="grid9"><input type="text" class="email" name="email" id="email" value="<?php echo stripslashes($resultPatient[0]['email']);?>"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Age:</label></div>
<div class="grid9"><input type="text" class="required" name="age" id="age" value="<?php echo stripslashes($resultPatient[0]['age']);?>"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Service:<span class="req">*</span></label></div>
<div class="grid9 searchDrop"><select data-placeholder="select service..." class="select" style="width: 100%" name="id_service">
<?php if($resultUsers1 && count($resultUsers1)>0)
foreach($resultUsers1 as $user)
{?>
<option value="<?php echo $user['id_photo']?>"<?php if($user['id_photo']==$user['title']) { ?> selected="selected" <?php } ?>><?php echo $user['title'];?></option>
<?php }?>
</select></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Phone:</label></div>
<div class="grid9"><input type="text" name="phone" id="phone" value="<?php echo stripslashes($resultPatient[0]['phone']);?>"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Date:</label></div>
<div class="grid9"><input type="text" class="required datepicker" name="date" id="date" value="<?php echo date('d-m-Y',strtotime($resultPatient[0]['date']));?>"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Time:</label></div>
<div class="grid9 searchDrop">
<input id="basicExample" type="text" name="time" class="time" value="<?php echo stripslashes($resultPatient[0]['time']);?>" style="width:80px"/>
</div>
<div class="clear"></div>
</div>
<input type="hidden" value="<?php echo $id; ?>" name="id" id="id_patient"/>
<input type="hidden" value="editPatient" name="requesttype"/>
<div class="formRow">
<div class="formSubmit">
<input class="buttonM bRed" id="next1" value="Save" type="submit">
<div class="clear"></div>
</div> <div class="clear"></div>
</div>
<div class="clear"></div></div>
</form>
</div>
</div>
<!-- Main content ends -->
</div>
<!-- Content ends -->
</body>
</html>
Add Appointment.php:
<?php
include_once 'config.php';
if(isset($_POST['requesttype'])&&$_POST['requesttype'] == 'addPatient'){
$insertInfo=array();
$insertInfo['users_id_user'] = $_REQUEST['id_user'];
$insertInfo['name'] = $_REQUEST['name'];
$insertInfo['email'] = $_REQUEST['email'];
$insertInfo['age'] = $_REQUEST['age'];
$insertInfo['gender'] = $_REQUEST['act'];
$insertInfo['service_id']=$_REQUEST['id_service'];
$insertInfo['phone'] = str_replace(array('(',')',' ','-'), array('','','',''),$_REQUEST['phone']);
$insertInfo['date'] = date('d-m-Y', strtotime($_REQUEST['date']));
$insertInfo['time'] = $_REQUEST['time'];
$insertInfo['confirm_status'] = 'c';
$date=date('Y-m-d H:i:s');
$insertInfo['date_created']=$date;
$insertInfo['date_updated']=$date;
$res=$db->insert('patients', $insertInfo);
$id=$_REQUEST['id_user'];
$where="t.users_id_user='$id' AND";
$query="SELECT t.device_id,t.platforms_id_platform as id_platform FROM tokens as t WHERE $where t.device_id!=''";
$resultTokens=$db->select($query);
if($resultTokens)
{
include_once 'Gcm.php';
include_once 'Apns.php';
$deviceTokens=array();
$deviceTokens1=array();
$alert='Your appointment is confirmed on '.$insertInfo['date'].' at '.$insertInfo['time'];
foreach($resultTokens as $token)
{
if($token['id_platform']=='1'&&$token['device_id']!='')
$deviceTokens[]=$token['device_id'];
if($token['id_platform']=='2'&&$token['device_id']!='')
$deviceTokens1[]=$token['device_id'];
}
if(count($deviceTokens)>0)
{
$apns=new Apns();
$apns->apnsPush($deviceTokens,$alert);
}
if(count($deviceTokens1)>0)
{
$gcm = new GCM();
$message = array("m" => $alert);
$result = $gcm->send_notification($deviceTokens1,$message);
}
}
header("Location:appointments.php?m=a");
}
$query="SELECT * FROM users";
$resultUsers=$db->select($query);
//$query="SELECT * FROM services";
$query="select * from photos where type='service'";
$resultUsers1=$db->select($query);
include_once 'header.php';
?>
<script type="text/javascript" src="js/jquery.timepicker.js"></script>
<link rel="stylesheet" type="text/css" href="js/jquery.timepicker.css" />
<script>
$(function() {
$('#basicExample').timepicker();
});
</script>
<!-- Sidebar begins -->
<div id="sidebar">
<!-- Left Main menu begins -->
<?php include_once 'menu.php'; ?>
<!-- Left Main menu ends -->
<!-- Secondary nav -->
<div class="secNav">
<div class="secWrapper">
<!--div class="secTop">
</div-->
<!-- Tabs container -->
<div id="tab-container" class="tab-container">
<div id="general">
<!-- Sidebar big buttons -->
<div id="general" style="display: block;" class="active">
<ul class="subNav">
<li class="activeli"><span class="icos-images2"></span>Add Appointment</li>
<li><span class="icos-images2"></span>View/Add Appointments</li>
<li><span class="icos-images2"></span>Appointments History</li>
<li><span class="icos-images2"></span>View/Add Reminder Settings</li>
<li><span class="icos-images2"></span>Add Reminder Settings</li>
<li><span class="icos-images2"></span>View/Add Medicine Reminder Settings</li>
<li><span class="icos-images2"></span>Add Medicine Reminder Settings</li>
</ul>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<!-- Sidebar ends -->
<!-- Content begins -->
<div id="content">
<div class="contentTop">
<span class="pageTitle"><span class="icon-screen"></span>Add Appointment</span>
<div class="clear"></div>
</div>
<!-- Breadcrumbs line -->
<div class="breadLine">
<div class="bc">
<ul id="breadcrumbs" class="breadcrumbs">
<li>Dashboard</li>
<li>Appointments</li>
<li class="current">Add Appointment</li>
</ul>
</div>
</div>
<!-- Main content -->
<div class="wrapper">
<div class="fluid">
<form name="formAddAppointment" id="usualValidate" class="main" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data">
<div class="widget grid6 chartWrapper" style="width:100%;min-height:680px;">
<div class="whead"><h6>Add Appointment Information</h6><div class="clear"></div></div>
<div class="formRow">
<div class="grid3"><label>File No:<span class="req">*</span></label></div>
<div class="grid9 searchDrop"><select data-placeholder="Choose a File No..." class="select" style="width: 100%" name="id_user">
<option value='0'>All</option>
<?php if($resultUsers && count($resultUsers)>0)
foreach($resultUsers as $user)
{?>
<option value="<?php echo $user['id_user']?>"><?php echo $user['fileno']?></option>
<?php }?>
</select></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Name:<span class="req">*</span></label></div>
<div class="grid9"><input type="text" class="required" name="name" id="name"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Email:</label></div>
<div class="grid9"><input type="text" class="email" name="email" id="email"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Age:</label></div>
<div class="grid9"><input type="text" class="required" name="age" id="age"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Sex:</label></div>
<div class="grid9 check"><label for="solve" class="mr20">Male:</label><input style="margin-top:5px;" type="radio" id="solve" name="act" value="m" class="required"/><label for="solve1" class="mr20">Female:</label><input style="margin-top:5px;" type="radio" id="solve1" name="act" value="f" /></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Service:<span class="req">*</span></label></div>
<div class="grid9 searchDrop"><select data-placeholder="select service..." class="select" style="width: 100%" name="id_service">
<option value='0'>All</option>
<?php if($resultUsers1 && count($resultUsers1)>0)
foreach($resultUsers1 as $user)
{?>
<option value="<?php echo $user['id_photo']?>"><?php echo $user['title']?></option>
<?php }?>
</select></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Phone:</label></div>
<div class="grid9"><input type="text" name="phone" id="phone" /></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Date:</label></div>
<div class="grid9"><input type="text" class="required datepicker" name="date" id="date" value="<?php echo date('d-m-Y',strtotime('now'));?>"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Time:</label></div>
<div class="grid9 searchDrop">
<input id="basicExample" type="text" class="time" style="width:80px" name="time"/>
</div>
<div class="clear"></div>
</div>
<input type="hidden" value="addPatient" name="requesttype"/>
<div class="formRow">
<div class="formSubmit">
<input class="buttonM bRed" id="next1" value="Save" type="submit">
<div class="clear"></div>
</div> <div class="clear"></div>
</div>
<div class="clear"></div></div>
</form>
</div>
</div>
<!-- Main content ends -->
</div>
<!-- Content ends -->
</body>
</html>
Find this code <?php if($user['id_photo']==$user['title']) { ?>. You should check the database value with the option value when you edit. Replace with <?php if($user['id_photo']==$resultPatient[0]['id_photo']) { ?> and check.

Categories