Laravel Blade #foreach : parse error - php

I'm new to Laravel, and I cannot find my mistake. I'm sure it's stupid, but the error message it's not really explicit, and I have not found a similar error on the net.
I have this Blade template:
#extends('basicTemplateInside')
#section('title')
ABC
#endsection
#section('content')
<table class="table table-striped">
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
#foreach ($lines as $line)
<tr>
<td> {{ $line->name }} </td>
<td> {{ $line->creationTimeStamp }} </td>
<td></td>
<td><span class="glyphicon glyphicon-pencil"></span></td>
<td><span class="glyphicon glyphicon-remove"></span></td>
</tr>
#endforeach
</tbody>
</table>
#endsection
and it gives me this error in line 19 [ #foreach ($lines as $line) ]:
Whoops, looks like something went wrong.
FatalErrorException in 79b7933d82e3f98a55e82cb71b63543f97265b8b.php line 19: parse error
1. in 79b7933d82e3f98a55e82cb71b63543f97265b8b.php line 19
If you think the problem might be in the controller, here is the code:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\CableType;
class CableTypesContoller extends Controller
{
public function show(){
$cableTypes = CableType::all();
//$data = array('lines'=>$cableTypes,'title'=>'Cable Types');
//return view('insideTable5wDelSee')->with($data);
return view('insideTable5wDelSee')->with('lines',$cableTypes);
}
}
The compiled file 79b7933d82e3f98a55e82cb71b63543f97265b8b.php :
<?php $__env->startSection('title'); ?>
ABC
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<table class="table table-striped">
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach($lines as $line): ?>
<tr>
<td> <?php echo e( $line->name); ?> </td>
<td> <?php echo e($line->creationTimeStamp); ?> </td>
<td></td>
<td><span class="glyphicon glyphicon-pencil"></span></td>
<td><span class="glyphicon glyphicon-remove"></span></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('basicTemplateInside', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
and basicTemplateInside.blade.php :
#extends('basicTemplate')
#section('body')
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"> ****** </a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>About</li>
<li>Contact</li>
<li class="dropdown">
Dropdown <span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="content" style="margin-top: 5%;">
<div class="col-md-10 col-md-offset-1">
<div class="row">
<h1>#yield('title')</h1>
</div>
<div class="row">
#yield('content')
</div>
</div>
</div>
#endsection
and basicTemplate.blade.php (if you need the one before, you might need this one too) :
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>****** - #yield('pageTitle')</title>
<link href="{{ URL::asset('css/bootstrap.min.css')}}" rel="stylesheet" >
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
#yield('body')
<script src="{{ URL::asset('js/jQuery.js')}}"></script>
<script src="{{ URL::asset('js/bootstrap.min.js')}}"></script>
</body>
</html>
Thank you for your time.

Related

How can I achieve a responsive table and form using Bootstrap 5?

Hi everyone this is the following code:
header.php
<?php
DatabaseConnect::getDbConnection();
?>
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Azubi Site</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
<body class="bg-light">
<?php if ($controller->getShowNavigationBar() === true) { ?>
<nav class="navbar p-2 navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" target="_blank" href="https://www.randompage.com/"><img width="100px" alt="Fatchip-Logo" class="img-thumbnail" src="Views/Images/random_logo.png"></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" aria-current="page" href="<?= $controller->getUrl('index.php')?>">List</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?= $controller->getUrl('index.php?controller=AzubiForm')?>">Form</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?= $controller->getUrl('index.php?controller=Profile')?>">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?= $controller->getUrl('index.php?controller=AzubiCards')?>">Team</a>
</li>
</ul>
<a class="dflex" href="<?= $controller->getUrl('index.php?controller=Logout')?>"><img width="50px" src="Views/Images/exit.png"></a>
</div>
</div>
<?php } ?>
</nav>
<?php include __DIR__.'/errorBox.php' ?>
<div class="container d-flex align-items-center justify-content-center">
list.php
<?php
/** #var AzubiList $controller */
$data = $controller->getAzubiData();
$search = $this->getRequestParameter('search');
$this->deleteSelected(); ?>
<div class="mainContent bg-light p-2">
<form class="list_form" action="<?php echo $controller->getUrl('index.php'); ?>" method="post">
<div class="input-group mb-3">
<input name="search" type="text" class="form-control" placeholder="Search" aria-label="Recipient's username" aria-describedby="basic-addon2">
<div class="input-group-append">
<input class="btn btn-primary" value="Search" type="submit" name="submit-search">
</div>
</div>
<br>
<table style="padding: 10px; border-radius: 10px;" class="table table-striped">
<thead class="table-dark">
<tr>
<th scope="col">Select</th>
<th scope="col">Name</th>
<th scope="col">Birthday</th>
<th scope="col">Email</th>
<th scope="col">Edit</th>
<th scope="col">Delete</th>
</tr>
</thead>
<tbody>
<?php
foreach ($data as $azubi){ ?>
<tr>
<td><input type="checkbox" class="selectButtonList" name="checkedId[]" value="<?= $azubi->getId(); ?>"></td>
<td><?= $azubi->getName(); ?></td>
<td><?= $azubi->getBirthday(); ?></td>
<td><?= $azubi->getEmail(); ?></td>
<td><img style="width: 25px" src="Views/images/1200px-Simpleicons_Business_crayon-pen-variant-in-diagonal-position.svg.png">
</td>
<td><img style="width: 15px" src="Views/images/1000_F_272554194_9bJhYSJkUcLbTjXfDlDANV2RyQYGO06N.jpg"></td>
</tr>
<?php }?>
</tbody>
</table>
<div class="pagination justify-content-center">
<?php
$totalPages = $controller->getNumberOfPages();
for ($i=1; $i <= $totalPages; $i++){
if (!empty($search)){
echo "<a class='page-link' href='index.php?page=".$i."&search=".$search."'>".$i."</a>";
echo "<br>";
echo "<br>";
echo "<a style='position: absolute; top: 0; right: 0;' class='btn btn-secondary' href='index.php'>Refresh Page</a>";
} else {
echo "<a class='page-link' href='index.php?page=".$i."'>".$i."</a>";
}
}
?>
</div>
<br>
<div class="row">
<div class="col-lg-6">
<div class="buttonLinkForm">
<a class="btn btn-success" role="button" href="<?php echo $controller->getUrl('index.php?controller=AzubiForm'); ?>">Neue Azubi anlegen</a>
</div>
</div>
<div class="col-lg-6 d-flex flex-row-reverse">
<div>
<input class="btn btn-danger" type="submit" name ="delete_all_button" value="Ausgewählte Azubis löschen">
</div>
</div>
</div>
</form>
</div>
Basically, I would like to display this webpage in a responsive manner, meaning that it can properly viewed on smaller displays(iphone 6/7/8). The Navbar has already been done, however I am having a bit of trouble with the table. Would kinly appreciate the help and suggestions! Thankyou!

how to use jquery in a laravel child blade file

Hello there I am new user of laravel 7. i want to use jquery in a blade file. if i create a blade file and on a top of it i mentioned all the head and body and then give the link of jquery in it then it works fine. but in my case i created a nav.blade.php file where i place all the navigation head and body code.
then i create another file and extend the nav file on the top of that file but in this case jquery does not working
nav.blade.php code
<html>
<head>
<meta charset="utf-8">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}" defer></script>
<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<!-- the below i use for jquery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="{{'addcategory'}}">Add Catgory <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{'showcategory'}}">show Category</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Manage Products
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{'
addproducts'}}">Add Products</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
#yield('content')
</body>
</html>
showcategories.blade.php file
this is the file where I want to use jquery and the upper file extended inside in this file
#extends('layouts.nav')
#section('content')
<table class="table">
<thead>
<tr>
<th scope="col">id</th>
<th scope="col">name</th>
<th scope="col">Delete</th>
<th scope="col">Update</th>
<th scope="col">Get Products</th>
</tr>
</thead>
<tbody>
#foreach($categories as $cat)
<tr>
<td>{{$cat->id}}</td>
<td>{{$cat->name}}</td>
<td><a class="btn btn-danger" href="{{url('delete',$cat->id)}}">Delete</a> </td>
<td><a class="btn btn-danger" href="{{url('update',$cat->id)}}">update</a> </td>
<td><a class="btn btn-danger" href="{{url('getproductjoin',$cat->id)}}">getproducts</a> </td>
</tr>
#endforeach
</tbody>
</table>
<button id="hello" class="btn btn-danger">hello</button>
#endsection
#section('script')
<script >
$(document).ready(function() {
$("#hello").click(function () {
alert("hello there");
})
});
</script>
#endsection
on this file the jquery does not working. please help me
You need to follow Laravel Syntax and standards to do this. You can create a standard layout file for the application. I.e. main.blade.php and in that file you can set the #yield the content which you need according to your requirements. For example your main.blade.php can be like this:
<html>
<head>
<meta charset="utf-8">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}" defer></script>
<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<!-- the below i use for jquery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="{{'addcategory'}}">Add Catgory <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{'showcategory'}}">show Category</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Manage Products
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{'
addproducts'}}">Add Products</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
#yield('content')
</body>
#yield('scripts')
</html>
And Your nav.blade.php can look like this.
#extends('layouts.main')
#section('content')
<table class="table">
<thead>
<tr>
<th scope="col">id</th>
<th scope="col">name</th>
<th scope="col">Delete</th>
<th scope="col">Update</th>
<th scope="col">Get Products</th>
</tr>
</thead>
<tbody>
#foreach($categories as $cat)
<tr>
<td>{{$cat->id}}</td>
<td>{{$cat->name}}</td>
<td><a class="btn btn-danger" href="{{url('delete',$cat->id)}}">Delete</a> </td>
<td><a class="btn btn-danger" href="{{url('update',$cat->id)}}">update</a> </td>
<td><a class="btn btn-danger" href="{{url('getproductjoin',$cat->id)}}">getproducts</a> </td>
</tr>
#endforeach
</tbody>
</table>
<button id="hello" class="btn btn-danger">hello</button>
#endsection
#section('scripts')
<script >
$(document).ready(function() {
$("#hello").click(function () {
alert("hello there");
})
});
</script>
#endsection
Or you can follow up the components standard and can create a component for your scripts to be included where ever you like. You can read more about the Laravel links over here:
https://laravel.com/docs/7.x/blade#components
You only yield the content, you need to yield the script too
</nav>
#yield('content')
</body>
#yield('script')
</html>
Add that in the bottom of your code

PHP/SQL How would I display the highest bid for a listing

https://imgur.com/a/PYokL
Hello,I am aware that there are some duplicate column in my database at the moment as I encountered some errors I'm just trying to make my website functional at the moment. I am currently working on displaying the highest bid for a listing.I am confused as to how I would find the highest bid for each specific listing as the bids all seem to bundle together into one table.I was wondering if anyone could help me do this?
<?php
require 'config.php';
if(isset($_POST['submit']))
{
$valueToSearch = $_POST['valueToSearch'];
// search in all table columns
// using concat mysql function
$query = "SELECT * FROM listings` WHERE CONCAT(`location`, `description`, `price`, `date`,`title`) LIKE '%".$valueToSearch."%'";
$query2 = "SELECT `listID` FROM listings"
$search_result = filterTable($query);
}
else {
$query = "SELECT * FROM `listings`";
$search_result = filterTable($query);
}
// function to connect and execute the query
function filterTable($query)
{
$conn = mysqli_connect("localhost", "root", "", "auction");
$filter_Result = mysqli_query($conn, $query);
return $filter_Result;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bid4MyJob</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Bid4MyJob">
<meta name="author" content="James Wood">
<!-- CSS -->
<link href="assets/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="assets/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="assets/css/main.css" rel="stylesheet" type="text/css">
<link href="assets/css/my-custom-styles.css" rel="stylesheet" type="text/css">
<!-- IE 9 Fallback-->
<!--[if IE 9]>
<link href="assets/css/ie.css" rel="stylesheet">
<![endif]-->
<!-- GOOGLE FONTS -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400italic,400,600,700' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed:300,300italic,400italic,700,400,300' rel='stylesheet' type='text/css'>
<!-- FAVICONS -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/repute144x144.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/repute114x114.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/repute72x72.png">
<link rel="apple-touch-icon-precomposed" href="assets/ico/repute57x57.png">
<link rel="shortcut icon" href="assets/ico/favicon.png">
</head>
<body>
<!-- WRAPPER -->
<div class="wrapper">
<!-- NAVBAR -->
<nav class="navbar navbar-default " role="navigation">
<div class="container">
<!-- TOPBAR -->
<div class="topbar">
<ul class="list-inline top-nav">
<li>
<div class="btn-group">
<button type="button" class="btn btn-link dropdown-toggle btn-xs" data-toggle="dropdown"><img src="assets/img/flags/United-Kingdom.png" alt="United Kingdom"> United Kingdom <span class="caret"></span></button>
<ul class="dropdown-menu dropdown-menu-right country-selector" role="menu">
<li>
<img src="assets/img/flags/United-Kingdom.png" alt="United Kingdom"> United Kingdom
</li>
<li>
<img src="assets/img/flags/Japan.png" alt="Japan"> Japan
</li>
<li>
<img src="assets/img/flags/China.png" alt="China"> China
</li>
<li>
<img src="assets/img/flags/Germany.png" alt="Germany"> Germany
</li>
</ul>
</div>
</li>
<li>Help</li>
<li>Support</li>
</ul>
<div class="searchbox">
<form method="post">
<div class="input-group input-group-sm">
<input type="text" class="form-control" placeholder="search ...">
<span class="input-group-btn">
<button class="btn btn-default" type="button"><i class="fa fa-search"></i></button>
</span>
</div>
</form>
</div>
</div>
<!-- END TOPBAR -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#main-nav">
<span class="sr-only">Toggle Navigation</span>
<i class="fa fa-bars"></i>
</button>
<a href="index.html" class="navbar-brand navbar-logo navbar-logo-bigger">
</a>
</div>
<!-- MAIN NAVIGATION -->
<div id="main-nav" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li>
HOME
</li>
<li>
HOW IT WORKS
</li>
<li>
POST JOB
</li>
<li>
FIND JOB
</li>
<li>
SIGN UP
</li>
<li>
LOGIN
</li>
</ul>
</div>
<!-- END MAIN NAVIGATION -->
</div>
</nav>
<!-- END NAVBAR -->
<!-- BREADCRUMBS -->
<div class="page-header">
<div class="container">
<h1 class="page-title pull-left">Find Job</h1>
<ol class="breadcrumb">
<li>Home</li>
<li class="active">Find Job</li>
</ol>
</div>
</div>
<!-- END BREADCRUMBS -->
<!-- PAGE CONTENT -->
<div class="page-content page-search-result">
<div class="container">
<!-- Search Form -->
<form class="form form-horizontal" action="findjob.php" method="post">
<div class="input-group input-group-lg">
<div class="input-group-btn">
<!--<select id="search-type-select" name="valueToSearch" class="multiselect multiselect-single-lg search-type-select">
<option value="all" selected="selected">All</option>
<option value="page">Page</option>
<option value="task">Task</option>
<option value="user">User</option>
<option value="image">Image</option>
</select>
</div>-->
<input class="form-control input-lg" type="text" name="valueToSearch" placeholder="type keyword ..." />
<span class="input-group-btn">
<button type="submit" name= "submit" value="Search" class="btn btn-primary btn-lg"><i class="icon ion-android-search"></i> Go</button>
</span>
</div>
</form>
<!-- End Search Form -->
</div>
</div>
<div>
<table>
<tr>
<th>Title</th>
<th>Location</th>
<th>Description</th>
<th>Budget</th>
<th>Due date</th>
</tr>
<!-- populate table from mysql database -->
<?php while($row = mysqli_fetch_array($search_result)):?>
<tr>
<td><?php echo $row['title'];?></td>
<td><?php echo $row['location'];?></td>
<td><?php echo $row['description'];?></td>
<td><?php echo $row['price'];?></td>
<td><?php echo $row['date'];?></td>
<td><form method="post" action="actionpage5.php" class="form-horizontal">
<?php //echo _("Enter ") . ' ' . $last_bid_plus . ' ' . _('or more'); ?>
<div class="input-group ">
<input type="number" value="bid" class="form-control" name="bid" id= "bid" required/>
</div>
<br/>
<input type="submit" name="sb_bid" value="<?php echo _('Place your Bid'); ?>"
class="btn btn-xlarge btn-block btn-primary"/>
<br/>
</form></td>
</tr>
<?php endwhile;?>
</table>
</div>
<!-- END PAGE CONTENT -->
<!-- FOOTER -->
<footer>
<div class="container">
<div class="row">
<div class="col-md-4">
<!-- COLUMN 1 -->
<h3 class="sr-only">ABOUT US</h3>
<img src="assets/img/logo/repute-logo-light.png" class="logo" alt="Repute">
<p>Proactively aggregate B2B initiatives before extensive channels. Monotonectally extend interactive methods of empowerment through excellent applications. Rapidiously synergize visionary products with sticky technology.</p>
<br>
<address class="margin-bottom-30px">
<ul class="list-unstyled">
<li>Unit 5, Block B Nesfield Road
<br/> Colchester, Essex CO4 3ZL 222222</li>
<li>Phone: 01206 588 000</li>
<li>Email: sales#universalwebdesign.co.uk</li>
</ul>
</address>
<!-- END COLUMN 1 -->
</div>
<div class="col-md-4">
<!-- COLUMN 2 -->
<h3 class="footer-heading">USEFUL LINKS</h3>
<div class="row margin-bottom-30px">
<div class="col-xs-6">
<ul class="list-unstyled footer-nav">
<li>About Us</li>
<li>News</li>
<li>Community</li>
<li>Career</li>
<li>Blog</li>
</ul>
</div>
<div class="col-xs-6">
<ul class="list-unstyled footer-nav">
<li>Press Kit</li>
<li>FAQ</li>
<li>Terms</li>
<li>Privacy Policy</li>
<li>Contact Us</li>
</ul>
</div>
</div>
<!-- END COLUMN 2 -->
</div>
<div class="col-md-4">
<!-- COLUMN 3 -->
<div class="newsletter">
<h3 class="footer-heading">NEWSLETTER</h3>
<p>Get the latest update from us by subscribing to our newsletter.</p>
<form class="newsletter-form" method="POST">
<div class="input-group input-group-lg">
<input type="email" class="form-control" name="email" placeholder="youremail#domain.com">
<span class="input-group-btn"><button class="btn btn-primary" type="button"><i class="fa fa-spinner fa-spin"></i><span>SUBSCRIBE</span></button>
</span>
</div>
<div class="alert"></div>
</form>
</div>
<div class="social-connect">
<h3 class="footer-heading">GET CONNECTED</h3>
<ul class="list-inline social-icons">
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-google-plus"></i></li>
<li><i class="fa fa-rss"></i></li>
</ul>
</div>
<!-- END COLUMN 3 -->
</div>
</div>
</div>
<!-- COPYRIGHT -->
<div class="text-center copyright">
©2018 Bid4MyJob. All Rights Reserved.
</div>
<!-- END COPYRIGHT -->
</footer>
<!-- END FOOTER -->
</div>
<!-- END WRAPPER -->
<!-- JAVASCRIPTS -->
<script src="assets/js/jquery-2.1.1.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/plugins/bootstrap-multiselect/bootstrap-multiselect.js"></script>
<script src="assets/js/plugins/autohidingnavbar/jquery.bootstrap-autohidingnavbar.min.js"></script>
<script src="assets/js/repute-scripts.js"></script>
</body>
</html>
$query = "SELECT MAX(bid) FROM listingsWHERE CONCAT(location,description,price,date,title`) LIKE '%".$valueToSearch."%' GROUP BY listing"

Cannot end a section without first starting one in Laravel 5.5

so I keep getting this error Cannot end a section without first starting one in Laravel on my website online but localhost it is working no problem I don't see anything wrong with the code and I tried changing #stop with #endsection still the same, and I repeat I got this error on my online website, not my localhost my localhost is working fine, btw when I removed the heading section the error is gone but I need it.
here's my code
#extends('AdminPanel.master.main')
#section('heading')
Banner Details
<a style="float: right" href="/admin/banners-list" class="btn btn-primary">
<i class="fa fa-arrow-left"></i> Back To List
</a>
#stop
#section('body')
<div class="panel">
<div class="table-responsive">
<ul class="nav nav-tabs" style="margin-bottom: 2%">
<li class="nav-item">
<a class="nav-link active" href="#tab_a" data-toggle="tab">English</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link" href="#tab_b" data-toggle="tab">العربية </a>
</li>
<li class="nav-item dropdown">
<a class="nav-link" href="#tab_c" data-toggle="tab">Urdu </a>
</li>
<li class="nav-item dropdown">
<a class="nav-link" href="#tab_d" data-toggle="tab">Chinese </a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active login-tabs" id="tab_a">
<table class="table table-hover profile">
<tbody>
<tr>
<td><i class="fa fa-user fa-fw"></i>Title</td>
<td> {{$data->TitleEn}}</td>
</tr>
<tr>
<td><i class="fa fa-user fa-fw"></i>Caption</td>
<td> {{$data->CaptionEn}}</td>
</tr>
<tr>
<td><i class="fa fa-user fa-fw"></i>Image</td>
<td><img #if($data->Image)src="/admin-assests/banner/{{$data->Image}}" #endif width="200px"
height="200px"></td>
</tr>
</tbody>
</table>
</div>
<div class="tab-pane login-tabs" id="tab_b">
<table class="table table-hover profile">
<tbody>
<tr>
<td><i class="fa fa-user fa-fw"></i>العنوان</td>
<td> {{$data->TitleAr}}</td>
</tr>
<tr>
<td><i class="fa fa-user fa-fw"></i>الوصف</td>
<td> {{$data->CaptionAr}}</td>
</tr>
<tr>
<td><i class="fa fa-user fa-fw"></i>Image</td>
<td><img #if($data->Image)src="/admin-assests/banner/{{$data->Image}}" #endif width="200px"
height="200px"></td>
</tr>
</tbody>
</table>
</div>
<div class="tab-pane login-tabs" id="tab_c">
<table class="table table-hover profile">
<tbody>
<tr>
<td><i class="fa fa-user fa-fw"></i>العنوان</td>
<td> {{$data->TitleUr}}</td>
</tr>
<tr>
<td><i class="fa fa-user fa-fw"></i>الوصف</td>
<td> {{$data->CaptionUr}}</td>
</tr>
<tr>
<td><i class="fa fa-user fa-fw"></i>Image</td>
<td><img #if($data->Image)src="/admin-assests/banner/{{$data->Image}}" #endif width="200px"
height="200px"></td>
</tr>
</tbody>
</table>
</div>
<div class="tab-pane login-tabs" id="tab_d">
<table class="table table-hover profile">
<tbody>
<tr>
<td><i class="fa fa-user fa-fw"></i>العنوان</td>
<td> {{$data->TitleCh}}</td>
</tr>
<tr>
<td><i class="fa fa-user fa-fw"></i>الوصف</td>
<td> {{$data->CaptionCh}}</td>
</tr>
<tr>
<td><i class="fa fa-user fa-fw"></i>Image</td>
<td><img #if($data->Image)src="/admin-assests/banner/{{$data->Image}}" #endif width="200px"
height="200px"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-4 pull-right">
Edit Info
</div>
</div>
#stop
main
<html lang="en">
<head>
#include('AdminPanel.master.head')
#include('AdminPanel.master.navbar')
</head>
<body>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">#yield('heading')</h1>
</div>
</div>
#yield('body')
</div>
#include('AdminPanel.master.footer')
</body>

I can't do login using $_SESSION on PHP

I'm trying to make a website with XAMP using PHP, MySQL and Bootstrap. I'm beginner in PHP so I take this code on website of developers and when I tried to run on localhost I typed my credentials and the index.php did a refresh only, not show nothing errors, just refresh. I researched on web for 5 days and nothing, here's my code:
index.php
<?php session_start(); ?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Signin Template for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link href="bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="signin.css" rel="stylesheet">
</head>
<body>
<div class="container">
<form class="form-signin" action="validacao.php" method="post">
<h2 class="form-signin-heading">Please sign in</h2>
<label for="txUsuario" class="sr-only">Email address</label>
<input type="text" name="usuario" id="txUsuario" class="form-control" placeholder="Email" required autofocus>
<label for="inputPassword" name="senha" class="sr-only">Password</label>
<input type="password" id="inputPassword" class="form-control" placeholder="Password" required>
<div class="checkbox">
<label>
<input type="checkbox" value="remember-me"> Remember me
</label>
</div>
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
</form>
</div> <!-- /container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>
validacao.php
<?php
// Verifica se houve POST e se o usuário ou a senha é(são) vazio(s)
if (!empty($_POST) AND (empty($_POST['usuario']) OR empty($_POST['senha']))) {
header("Location: index.php"); exit;
}
// Tenta se conectar ao servidor MySQL
mysql_connect('localhost', 'root', '') or trigger_error(mysql_error());
// Tenta se conectar a um banco de dados MySQL
mysql_select_db('wda_crud') or trigger_error(mysql_error());
$usuario = mysql_real_escape_string($_POST['usuario']);
$senha = mysql_real_escape_string($_POST['senha']);
// Validação do usuário/senha digitados
$sql = "SELECT `id`, `nome`, `nivel` FROM `usuarios` WHERE (`usuario` = '".$usuario ."') AND (`senha` = '".$senha ."') AND (`ativo` = 1) LIMIT 1";
$query = mysql_query($sql);
if (mysql_num_rows($query) != 1) {
// Mensagem de erro quando os dados são inválidos e/ou o usuário não foi encontrado
echo "Login inválido!"; exit;
} else {
// Salva os dados encontrados na variável $resultado
$resultado = mysql_fetch_assoc($query);
// Se a sessão não existir, inicia uma
if (!isset($_SESSION)) session_start();
// Salva os dados encontrados na sessão
$_SESSION['UsuarioID'] = $resultado['id'];
$_SESSION['UsuarioNome'] = $resultado['nome'];
$_SESSION['UsuarioNivel'] = $resultado['nivel'];
// Redireciona o visitante
header("Location: site.php"); exit;
}
?>
site.php
<?php session_start(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Dashboard Template for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link href="bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="dashboard.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-toggleable-md navbar-inverse fixed-top bg-inverse">
<button class="navbar-toggler navbar-toggler-right hidden-lg-up" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#"><?php echo $_SESSION['UsuarioNome']; ?></a>
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Settings</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Help</a>
</li>
</ul>
<form class="form-inline mt-2 mt-md-0">
<input class="form-control mr-sm-2" type="text" placeholder="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<nav class="col-sm-3 col-md-2 hidden-xs-down bg-faded sidebar">
<ul class="nav nav-pills flex-column">
<li class="nav-item">
<a class="nav-link active" href="#">Overview <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Reports</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Analytics</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Export</a>
</li>
</ul>
<ul class="nav nav-pills flex-column">
<li class="nav-item">
<a class="nav-link" href="#">Nav item</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Nav item again</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">One more nav</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Another nav item</a>
</li>
</ul>
<ul class="nav nav-pills flex-column">
<li class="nav-item">
<a class="nav-link" href="#">Nav item again</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">One more nav</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Another nav item</a>
</li>
</ul>
</nav>
<main class="col-sm-9 offset-sm-3 col-md-10 offset-md-2 pt-3">
<h1>Dashboard</h1>
<section class="row text-center placeholders">
<div class="col-6 col-sm-3 placeholder">
<img src="data:image/gif;base64,R0lGODlhAQABAIABAAJ12AAAACwAAAAAAQABAAACAkQBADs=" width="200" height="200" class="img-fluid rounded-circle" alt="Generic placeholder thumbnail">
<h4>Label</h4>
<div class="text-muted">Something else</div>
</div>
<div class="col-6 col-sm-3 placeholder">
<img src="data:image/gif;base64,R0lGODlhAQABAIABAADcgwAAACwAAAAAAQABAAACAkQBADs=" width="200" height="200" class="img-fluid rounded-circle" alt="Generic placeholder thumbnail">
<h4>Label</h4>
<span class="text-muted">Something else</span>
</div>
<div class="col-6 col-sm-3 placeholder">
<img src="data:image/gif;base64,R0lGODlhAQABAIABAAJ12AAAACwAAAAAAQABAAACAkQBADs=" width="200" height="200" class="img-fluid rounded-circle" alt="Generic placeholder thumbnail">
<h4>Label</h4>
<span class="text-muted">Something else</span>
</div>
<div class="col-6 col-sm-3 placeholder">
<img src="data:image/gif;base64,R0lGODlhAQABAIABAADcgwAAACwAAAAAAQABAAACAkQBADs=" width="200" height="200" class="img-fluid rounded-circle" alt="Generic placeholder thumbnail">
<h4>Label</h4>
<span class="text-muted">Something else</span>
</div>
</section>
<h2>Section title</h2>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>Header</th>
<th>Header</th>
<th>Header</th>
<th>Header</th>
</tr>
</thead>
<tbody>
<tr>
<td>1,001</td>
<td>Lorem</td>
<td>ipsum</td>
<td>dolor</td>
<td>sit</td>
</tr>
<tr>
<td>1,002</td>
<td>amet</td>
<td>consectetur</td>
<td>adipiscing</td>
<td>elit</td>
</tr>
<tr>
<td>1,003</td>
<td>Integer</td>
<td>nec</td>
<td>odio</td>
<td>Praesent</td>
</tr>
<tr>
<td>1,003</td>
<td>libero</td>
<td>Sed</td>
<td>cursus</td>
<td>ante</td>
</tr>
<tr>
<td>1,004</td>
<td>dapibus</td>
<td>diam</td>
<td>Sed</td>
<td>nisi</td>
</tr>
<tr>
<td>1,005</td>
<td>Nulla</td>
<td>quis</td>
<td>sem</td>
<td>at</td>
</tr>
<tr>
<td>1,006</td>
<td>nibh</td>
<td>elementum</td>
<td>imperdiet</td>
<td>Duis</td>
</tr>
<tr>
<td>1,007</td>
<td>sagittis</td>
<td>ipsum</td>
<td>Praesent</td>
<td>mauris</td>
</tr>
<tr>
<td>1,008</td>
<td>Fusce</td>
<td>nec</td>
<td>tellus</td>
<td>sed</td>
</tr>
<tr>
<td>1,009</td>
<td>augue</td>
<td>semper</td>
<td>porta</td>
<td>Mauris</td>
</tr>
<tr>
<td>1,010</td>
<td>massa</td>
<td>Vestibulum</td>
<td>lacinia</td>
<td>arcu</td>
</tr>
<tr>
<td>1,011</td>
<td>eget</td>
<td>nulla</td>
<td>Class</td>
<td>aptent</td>
</tr>
<tr>
<td>1,012</td>
<td>taciti</td>
<td>sociosqu</td>
<td>ad</td>
<td>litora</td>
</tr>
<tr>
<td>1,013</td>
<td>torquent</td>
<td>per</td>
<td>conubia</td>
<td>nostra</td>
</tr>
<tr>
<td>1,014</td>
<td>per</td>
<td>inceptos</td>
<td>himenaeos</td>
<td>Curabitur</td>
</tr>
<tr>
<td>1,015</td>
<td>sodales</td>
<td>ligula</td>
<td>in</td>
<td>libero</td>
</tr>
</tbody>
</table>
</div>
</main>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="../../dist/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>
Someone can tell me what is the error? It can be the XAMP?
Your error in this line
There is no name field in
<input type="password" id="inputPassword" class="form-control" placeholder="Password" required>
you have put name field in label
<label for="inputPassword" name="senha" class="sr-only">Password</label>
change this two lines to
<input type="password" name="senha" id="inputPassword" class="form-control" placeholder="Password" required>
<label for="inputPassword" class="sr-only">Password</label>
The <input...> tags must have a name= attribute or they will not be sent from the HTML form to the PHP script by the browser.
So add a name= attribute to this <input>
<input type="password" name="senha" id="inputPassword" class="form-control" placeholder="Password" required>
^^^^^^^^^^^^
I am guessing its just a typo because you have a name="senha" attribute in the <label> and that is not necessary.
<label for="inputPassword" name="senha" class="sr-only">Password</label>
can be removed ^^^^^^^^^^^^
Note: You should always code your session_start(); at the top of your scripts right after the first <?php

Categories