Browser disabled after logout in codeigniter - php

The admin controller I have:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Admin extends CI_controller{
public function __construct(){
parent::__construct();
$this->load->model('common');
$this->load->library('session');
}
public function index(){
$this->load->view("login");
}
public function matched(){
$this->form_validation->set_rules('name','Name','required');
$this->form_validation->set_rules('pass','Password','required');
if($this->form_validation->run()==FALSE){
$error['error']=validation_errors();
$this->load->view('login',$error);
}
else{
$name= $this->input->post('name');
$pass=$this->input->post('pass');
$result=$this->common->match_data($name,$pass);
if(!empty($result)){
$data=array(
'id'=>$result[0]->id,
'name'=>$result[0]->name,
'type'=>$result[0]->type,
'logged_in'=>TRUE
);
$this->session->set_userdata($data);
redirect('dashboard');
}
else{
$this->load->view('login');
}
}
}
public function logoutuser(){
$this->session->sess_destroy();
redirect("admin","refresh");
}
}
?>
Dashboard Controller :
<?php
class Dashboard extends CI_controller{
public function __construct(){
parent::__construct();
$this->load->model('common');
}
public function index(){
$this->load->view('dashboard');
}
}
?>
Dashboard page or view page:
<?php
//echo "<pre>";print_r($this->session->all_userdata());exit;
$name=$this->session->userdata('name');
$id=$this->session->userdata('id');
$type=$this->session->userdata('type');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>SB Admin - Bootstrap Admin Template</title>
<!-- Bootstrap Core CSS -->
<link href="<?php echo base_url();?>assets/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="<?php echo base_url();?>assets/css/sb-admin.css" rel="stylesheet">
<!-- Morris Charts CSS -->
<link href="<?php echo base_url();?>assets/css/plugins/morris.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="<?php echo base_url();?>assets/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="wrapper">
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<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=""><?php echo "User"."-".ucwords($type); ?></a>
</div>
<!-- Top Menu Items -->
<ul class="nav navbar-right top-nav">
<li class="dropdown">
<i class="fa fa-envelope"></i> <b class="caret"></b>
<ul class="dropdown-menu message-dropdown">
<li class="message-preview">
<a href="#">
<div class="media">
<span class="pull-left">
<img class="media-object" src="http://placehold.it/50x50" alt="">
</span>
<div class="media-body">
<h5 class="media-heading"><strong><?php echo $name;?></strong>
</h5>
<p class="small text-muted"><i class="fa fa-clock-o"></i> Yesterday at 4:32 PM</p>
<p>Lorem ipsum dolor sit amet, consectetur...</p>
</div>
</div>
</a>
</li>
<li class="message-preview">
<a href="#">
<div class="media">
<span class="pull-left">
<img class="media-object" src="http://placehold.it/50x50" alt="">
</span>
<div class="media-body">
<h5 class="media-heading"><strong><?php echo $name;?></strong>
</h5>
<p class="small text-muted"><i class="fa fa-clock-o"></i> Yesterday at 4:32 PM</p>
<p>Lorem ipsum dolor sit amet, consectetur...</p>
</div>
</div>
</a>
</li>
<li class="message-preview">
<a href="#">
<div class="media">
<span class="pull-left">
<img class="media-object" src="http://placehold.it/50x50" alt="">
</span>
<div class="media-body">
<h5 class="media-heading"><strong><?php echo $name;?></strong>
</h5>
<p class="small text-muted"><i class="fa fa-clock-o"></i> Yesterday at 4:32 PM</p>
<p>Lorem ipsum dolor sit amet, consectetur...</p>
</div>
</div>
</a>
</li>
<li class="message-footer">
Read All New Messages
</li>
</ul>
</li>
<li class="dropdown">
<i class="fa fa-bell"></i> <b class="caret"></b>
<ul class="dropdown-menu alert-dropdown">
<li>
Alert Name <span class="label label-default">Alert Badge</span>
</li>
<li>
Alert Name <span class="label label-primary">Alert Badge</span>
</li>
<li>
Alert Name <span class="label label-success">Alert Badge</span>
</li>
<li>
Alert Name <span class="label label-info">Alert Badge</span>
</li>
<li>
Alert Name <span class="label label-warning">Alert Badge</span>
</li>
<li>
Alert Name <span class="label label-danger">Alert Badge</span>
</li>
<li class="divider"></li>
<li>
View All
</li>
</ul>
</li>
<li class="dropdown">
<i class="fa fa-user"></i> <?php echo $name;?><b class="caret"></b>
<ul class="dropdown-menu">
<li>
<i class="fa fa-fw fa-user"></i> Profile
</li>
<li>
<i class="fa fa-fw fa-envelope"></i> Inbox
</li>
<li>
<i class="fa fa-fw fa-gear"></i> Settings
</li>
<li class="divider"></li>
<li>
<i class="fa fa-fw fa-power-off"></i> Log Out
</li>
</ul>
</li>
</ul>
<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
<li class="active">
<i class="fa fa-fw fa-dashboard"></i> Dashboard
</li>
<li>
<i class="fa fa-fw fa-bar-chart-o"></i> Charts
</li>
<li>
<i class="fa fa-fw fa-table"></i> Tables
</li>
<li>
<i class="fa fa-fw fa-edit"></i> Forms
</li>
<li>
<i class="fa fa-fw fa-desktop"></i> Bootstrap Elements
</li>
<li>
<i class="fa fa-fw fa-wrench"></i> Bootstrap Grid
</li>
<li>
<i class="fa fa-fw fa-arrows-v"></i> Dropdown <i class="fa fa-fw fa-caret-down"></i>
<ul id="demo" class="collapse">
<li>
Dropdown Item
</li>
<li>
Dropdown Item
</li>
</ul>
</li>
<li>
<i class="fa fa-fw fa-file"></i> Blank Page
</li>
<li>
<i class="fa fa-fw fa-dashboard"></i> RTL Dashboard
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Dashboard <small>Statistics Overview</small>
</h1>
<ol class="breadcrumb">
<li class="active">
<i class="fa fa-dashboard"></i> Dashboard
</li>
</ol>
</div>
</div>
<!-- /.row -->
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->
</div>
<!-- /#wrapper -->
<!-- jQuery -->
<script src="<?php echo base_url();?>assets/js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="<?php echo base_url();?>assets/js/bootstrap.min.js"></script>
<!-- Morris Charts JavaScript -->
<script src="<?php echo base_url();?>assets/js/plugins/morris/raphael.min.js"></script>
<script src="<?php echo base_url();?>assets/js/plugins/morris/morris.min.js"></script>
<script src="<?php echo base_url();?>assets/js/plugins/morris/morris-data.js"></script>
</body>
</html>
problem is that when i am clicking on the browser back button its take me back on logged in user ..ever time i need to disable browser back button using codeigniter without using javascript

You need to check session in your controller
<?php
class Dashboard extends CI_controller{
public function __construct(){
parent::__construct();
$this->load->model('common');
$this->load->library('session');
}
public function index(){
if($this->session->all_userdata()){
$this->load->view('dashboard');
}
else{
redirect('lofin_contoller');
}
}
}
?>

Disabling back button of browser is not possible in codeigniter.
While there is alternative ways of Redirecting user upon destroying session to that page which we want.
check session variable in your view,controller is it working..
echo $_SESSION['session_varibalename'];
Also you can see this link too: how to disable the back button in codeigniter?
<?php
class Dashboard extends CI_controller{
public function __construct(){
parent::__construct();
$this->load->model('common');
$this->load->library('session');
}
public function index(){
$logged_in = $this->session->userdata('logged_in');
if($logged_in == TRUE || empty($logged_in))
{
//user not logged in
$this->session->set_flashdata('error', 'Session has Expired');
//it will redirect the user to the Admin controller to index function which will call the login view.
redirect('Admin/index');
}
else
{
//user Logged in
$this->load->view('dashboard');
}
}
}

Related

Laravel Blade template on c9 is only selectively extending to certain pages

My blade template is extending to the index.blade.php with no problem, but doesn't extend to create.blade.php at all which is located in the subfolder. It simply displays the "Create Users" and nothing else. I'm currently using Laravel 5.2 and PHP 5.5.
Following is my admin.blade.php which is the layout template:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Admin</title>
<!-- Bootstrap Core CSS -->
<link href="/css/app.css" rel="stylesheet" type="text/css">
<link href="/css/libs.css" rel="stylesheet" type="text/css">
<!--<link rel="stylesheet" href="{{ URL::asset('/css/app.css') }}">-->
<!--<link rel="stylesheet" href="{{ URL::asset('/css/libs.css') }}">-->
<!--<link rel="stylesheet" href="{{ URL::asset('/css/bootstrap.css') }}">-->
<!--<link href="{{asset('css/app.css')}}" rel="stylesheet">-->
<!--<link href="{{asset('css/libs.css')}}" rel="stylesheet">-->
<!--<link href="/css/blog-post.css" rel="stylesheet" type="text/css">-->
<!--<link href="/css/bootstrap.css" rel="stylesheet" type="text/css">-->
<!--<link href="/css/bootstrap.min.css" rel="stylesheet" type="text/css">-->
<!--<link href="/css/font-awesome.css" rel="stylesheet" type="text/css">-->
<!--<link href="/css/metisMenu.css" rel="stylesheet" type="text/css">-->
<!--<link href="/css/sb-admin-2.css" rel="stylesheet" type="text/css">-->
<!--<link href="/css/styles.css" rel="stylesheet" type="text/css">-->
<!--<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.css">-->
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body id="admin-page">
<div id="wrapper">
<!-- Navigation -->
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<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="/">Home</a>
</div>
<!-- /.navbar-header -->
<ul class="nav navbar-top-links navbar-right">
<!-- /.dropdown -->
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><i class="fa fa-user fa-fw"></i> User Profile
</li>
<li><i class="fa fa-gear fa-fw"></i> Settings
</li>
<li class="divider"></li>
<li><i class="fa fa-sign-out fa-fw"></i> Logout
</li>
</ul>
<!-- /.dropdown-user -->
</li>
<!-- /.dropdown -->
</ul>
{{--<ul class="nav navbar-nav navbar-right">--}}
{{--#if(auth()->guest())--}}
{{--#if(!Request::is('auth/login'))--}}
{{--<li>Login</li>--}}
{{--#endif--}}
{{--#if(!Request::is('auth/register'))--}}
{{--<li>Register</li>--}}
{{--#endif--}}
{{--#else--}}
{{--<li class="dropdown">--}}
{{--{{ auth()->user()->name }} <span class="caret"></span>--}}
{{--<ul class="dropdown-menu" role="menu">--}}
{{--<li>Logout</li>--}}
{{--<li>Profile</li>--}}
{{--</ul>--}}
{{--</li>--}}
{{--#endif--}}
{{--</ul>--}}
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<li class="sidebar-search">
<div class="input-group custom-search-form">
<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>
<!-- /input-group -->
</li>
<li>
<i class="fa fa-dashboard fa-fw"></i> Dashboard
</li>
<li>
<i class="fa fa-wrench fa-fw"></i>Users<span class="fa arrow"></span>
<ul class="nav nav-second-level">
<li>
All Users
</li>
<li>
Create User
</li>
</ul>
<!-- /.nav-second-level -->
</li>
<li>
<i class="fa fa-wrench fa-fw"></i> Posts<span class="fa arrow"></span>
<ul class="nav nav-second-level">
<li>
All Posts
</li>
<li>
Create Post
</li>
</ul>
<!-- /.nav-second-level -->
</li>
<li>
<i class="fa fa-wrench fa-fw"></i>Categories<span class="fa arrow"></span>
<ul class="nav nav-second-level">
<li>
All Categories
</li>
<li>
Create Category
</li>
</ul>
<!-- /.nav-second-level -->
</li>
<li>
<i class="fa fa-wrench fa-fw"></i>Media<span class="fa arrow"></span>
<ul class="nav nav-second-level">
<li>
All Media
</li>
<li>
Upload Media
</li>
</ul>
<!-- /.nav-second-level -->
</li>
<li>
<i class="fa fa-bar-chart-o fa-fw"></i> Charts<span class="fa arrow"></span>
<ul class="nav nav-second-level">
<li>
Flot Charts
</li>
<li>
Morris.js Charts
</li>
</ul>
<!-- /.nav-second-level -->
</li>
<li>
<i class="fa fa-table fa-fw"></i> Tables
</li>
<li>
<i class="fa fa-edit fa-fw"></i> Forms
</li>
<li>
<i class="fa fa-wrench fa-fw"></i> UI Elements<span class="fa arrow"></span>
<ul class="nav nav-second-level">
<li>
Panels and Wells
</li>
<li>
Buttons
</li>
<li>
Notifications
</li>
<li>
Typography
</li>
<li>
Icons
</li>
<li>
Grid
</li>
</ul>
<!-- /.nav-second-level -->
</li>
<li>
<i class="fa fa-sitemap fa-fw"></i> Multi-Level Dropdown<span class="fa arrow"></span>
<ul class="nav nav-second-level">
<li>
Second Level Item
</li>
<li>
Second Level Item
</li>
<li>
Third Level <span class="fa arrow"></span>
<ul class="nav nav-third-level">
<li>
Third Level Item
</li>
<li>
Third Level Item
</li>
<li>
Third Level Item
</li>
<li>
Third Level Item
</li>
</ul>
<!-- /.nav-third-level -->
</li>
</ul>
<!-- /.nav-second-level -->
</li>
<li class="active">
<i class="fa fa-files-o fa-fw"></i> Sample Pages<span class="fa arrow"></span>
<ul class="nav nav-second-level">
<li>
<a class="active" href="blank.html">Blank Page</a>
</li>
<li>
Login Page
</li>
</ul>
<!-- /.nav-second-level -->
</li>
</ul>
</div>
<!-- /.sidebar-collapse -->
</div>
<!-- /.navbar-static-side -->
</nav>
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<li>
<i class="fa fa-dashboard fa-fw"></i>Profile
</li>
<li>
<i class="fa fa-wrench fa-fw"></i> Posts<span class="fa arrow"></span>
<ul class="nav nav-second-level">
<li>
All Posts
</li>
<li>
Create Post
</li>
</ul>
<!-- /.nav-second-level -->
</li>
</ul>
</div>
</div>
</div>
<!-- Page Content -->
<div id="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header"></h1>
#yield('content')
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->
</div>
<!-- /#wrapper -->
<!-- jQuery -->
<script src="/js/jquery.js"></script>
<script src="/js/libs.js"></script>
<script src="/js/bootstrap.js"></script>
<script src="/js/scripts.js"></script>
<script src="/js/sb-admin-2.js"></script>
<script src="/js/metisMenu.js"></script>
<!--<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>-->
<!--<script src="https://code.jquery.com/jquery-1.12.4.js" integrity="sha256-Qw82+bXyGq6MydymqBxNPYTaUXXq7c8v3CwiYwLLNXU=" crossorigin="anonymous"></script>-->
#yield('footer')
</body>
</html>
Following is my create.blade.php:
#extends('layouts.admin')
#section('content')
<h1>Create Users</h1>
#stop
Following is my AdminUsersController:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\User;
class AdminUsersController extends Controller
{
/**
* Display a listing of the resource.
*
* #return \Illuminate\Http\Response
*/
public function index()
{
$users = User::all();
return view('admin.users.index', compact('users'));
}
/**
* Show the form for creating a new resource.
*
* #return \Illuminate\Http\Response
*/
public function create()
{
return view('admin.users.create');
}
/**
* Store a newly created resource in storage.
*
* #param \Illuminate\Http\Request $request
* #return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function show($id)
{
return view('admin.users.show');
}
/**
* Show the form for editing the specified resource.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function edit($id)
{
return view('admin.users.edit');
}
/**
* Update the specified resource in storage.
*
* #param \Illuminate\Http\Request $request
* #param int $id
* #return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
And finally my route:
Route::resource('admin/users', 'AdminUsersController');`
Following is the picture of my file structure
Thank you in advance.
#extends('path_to_index.blade.php') will fix your problem if create.blade.php extends index.blade.php. If create.blade.php extends main.blade.php and index.blade.php extends create.blade.php then you should extend index.blade.php.

Select database with laravel 5.5

I am trying to query the database and get user information.
I use the adminlte System but when I run the view it returns a variable error.
HomeController.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* #return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* #return \Illuminate\Http\Response
*/
public function index()
{
$users = DB::select('select * from users');
return view('vendor.adminlte.page', ['users' => $users]);
}
}
Page.blade.php
#extends('adminlte::master')
#section('adminlte_css')
<link rel="stylesheet"
href="{{ asset('vendor/adminlte/dist/css/skins/skin-' . config('adminlte.skin', 'blue') . '.min.css')}} ">
#stack('css')
#yield('css')
#stop
#section('body_class', 'skin-' . config('adminlte.skin', 'blue') . ' sidebar-mini ' . (config('adminlte.layout') ? [
'boxed' => 'layout-boxed',
'fixed' => 'fixed',
'top-nav' => 'layout-top-nav'
][config('adminlte.layout')] : '') . (config('adminlte.collapse_sidebar') ? ' sidebar-collapse ' : ''))
#section('body')
<div class="wrapper">
<div class="wrapper" style="height: auto; min-height: 100%;">
<header class="main-header">
<!-- Logo -->
<a href="/home" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>U</b></span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg"><b>UNIDAS</b></span>
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<!-- Messages: style can be found in dropdown.less-->
<li class="dropdown messages-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope-o"></i>
<span class="label label-success">4</span>
</a>
<ul class="dropdown-menu">
<li class="header">Você tem 4 mensagens</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- start message -->
<a href="#">
<div class="pull-left">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Informática
<small><i class="fa fa-clock-o"></i> 5 minutos</small>
</h4>
<p>Está conseguindo concluir?</p>
</a>
</li>
<!-- end message -->
<li>
<a href="#">
<div class="pull-left">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Financeiro
<small><i class="fa fa-clock-o"></i> 2 horas</small>
</h4>
<p>Está conseguindo concluir?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Contabilidade
<small><i class="fa fa-clock-o"></i> Hoje</small>
</h4>
<p>Está conseguindo concluir?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Institucional
<small><i class="fa fa-clock-o"></i> Ontem</small>
</h4>
<p>Está conseguindo concluir?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Gerência
<small><i class="fa fa-clock-o"></i> 2 Dias</small>
</h4>
<p>Está conseguindo concluir?</p>
</a>
</li>
</ul>
</li>
<li class="footer">Ler todas Mensagens</li>
</ul>
</li>
<!-- Notifications: style can be found in dropdown.less -->
<li class="dropdown notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-bell-o"></i>
<span class="label label-warning">10</span>
</a>
<ul class="dropdown-menu">
<li class="header">Você tem 10 notificações</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li>
<a href="#">
<i class="fa fa-users text-aqua"></i>Não Imprimir Colorido
</a>
</li>
<li>
<a href="#">
<i class="fa fa-warning text-yellow"></i>Nova Reunião Redir
</a>
</li>
<li>
<a href="#">
<i class="fa fa-users text-red"></i>Aviso Copa
</a>
</li>
<li>
<a href="#">
<i class="fa fa-shopping-cart text-green"></i>Data Congresso Internacional
</a>
</li>
<li>
<a href="#">
<i class="fa fa-user text-red"></i> Banco de Horas
</a>
</li>
</ul>
</li>
<li class="footer">Ver todas Notificações</li>
</ul>
</li>
<!-- Tasks: style can be found in dropdown.less -->
<li class="dropdown tasks-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-flag-o"></i>
<span class="label label-danger">9</span>
</a>
<ul class="dropdown-menu">
<li class="header">Você tem 9 tarefas</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- Task item -->
<a href="#">
<h3>
Desenvolver Intranet
<small class="pull-right">20%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">20% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
<li><!-- Task item -->
<a href="#">
<h3>
Desenvolver novo layout
<small class="pull-right">40%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-green" style="width: 40%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">40% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
<li><!-- Task item -->
<a href="#">
<h3>
Desenvolver novo Administrador
<small class="pull-right">60%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-red" style="width: 60%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">60% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
<li><!-- Task item -->
<a href="#">
<h3>
Unificar superitêndencias
<small class="pull-right">80%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-yellow" style="width: 80%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">80% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
</ul>
</li>
<li class="footer">
Ver todas Tarefas
</li>
</ul>
</li>
<!-- User Account: style can be found in dropdown.less -->
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<img src="images/usuarios/richardnicson.jpg" class="user-image" alt="User Image">
<span class="hidden-xs">Richard Nicson</span>
</a>
<ul class="dropdown-menu">
<!-- User image -->
<li class="user-header">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
<p>
Richard Nicson Costa de Lima - Desenvolvedor Web
<small>Membro desde Agosto. 2018</small>
</p>
</li>
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left">
Perfil
</div>
<div class="pull-right">
<a href="#" class="btn btn-default btn-flat" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
<i class="fa fa-fw fa-power-off"></i> Sair
</a>
<form id="logout-form" action="http://intranet.unidas.org.br/logout" method="POST" style="display: none;">
<input type="hidden" name="_token" value="jmubQRfJenzcLKmbpvyjeMCVeafWedS5IPC36tmk">
</form>
</div>
</li>
</ul>
</li>
</ul>
</div>
</nav>
</header>
#if(config('adminlte.layout') != 'top-nav')
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<div class="pull-left info">
<p>Richard Nicson</p>
<i class="fa fa-circle text-success"></i> Online
</div>
</div>
<!-- search form -->
<form action="#" method="get" class="sidebar-form">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Pesquisar...">
<span class="input-group-btn">
<button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
</button>
</span>
</div>
</form>
<!-- /.search form -->
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu tree" data-widget="tree">
#each('adminlte::partials.menu-item', $adminlte->menu(), 'item')
</ul>
</section>
<!-- /.sidebar -->
</aside>
#endif
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper" style="min-height: 1265px;">
#if(config('adminlte.layout') == 'top-nav')
<div class="container">
#endif
<!-- Content Header (Page header) -->
<section class="content-header">
#yield('content_header')
</section>
<!-- Main content -->
<section class="content">
#yield('content')
</section>
<!-- /.content -->
#if(config('adminlte.layout') == 'top-nav')
</div>
<!-- /.container -->
#endif
</div>
<!-- /.content-wrapper -->
</div>
<!-- ./wrapper -->
#stop
#section('adminlte_js')
<script src="{{ asset('vendor/adminlte/dist/js/adminlte.min.js') }}"></script>
#stack('js')
#yield('js')
#stop
Error:
ErrorException (E_ERROR) Undefined variable: adminlte (View:
/home/unidas/intranet/resources/views/vendor/adminlte/page.blade.php)

how can i pass my variable to my modal?

I'm having a hard time on passing my variable to my modal.
I can't simply pass my informant id to my modal and I really would want to use it for my query as my base to search for or compare it.
I don't know how to pass it like the URL passing of variable using GET function and I'm really new to this and just wanted to try modal unlike creating a new page for a summary.
Code:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=deviceADMIN | Missing Person Tracking System-width, initial-scale=1.0" />
<title>ADMIN | Missing Person Tracking System </title>
<!-- Bootstrap Styles-->
<link href="assets/css/bootstrap.css" rel="stylesheet" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- FontAwesome Styles-->
<link href="assets/css/font-awesome.css" rel="stylesheet" />
<!-- Morris Chart Styles-->
<link href="assets/js/morris/morris-0.4.3.min.css" rel="stylesheet" />
<!-- Custom Styles-->
<link href="assets/css/custom-styles.css" rel="stylesheet" />
<!-- Google Fonts-->
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
</head>
<body>
<div id="wrapper">
<nav class="navbar navbar-default top-navbar" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
<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="index.php"><i class="fa fa-shield"></i> <strong>POLICE ADMIN </strong></a>
</div>
<ul class="nav navbar-top-links navbar-right">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
<i class="fa fa-bell fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-alerts">
<li>
<a href="#">
<div>
<i class="fa fa-comment fa-fw"></i> New Comment
<span class="pull-right text-muted small">4 min</span>
</div>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#">
<div>
<i class="fa fa-twitter fa-fw"></i> 3 New Followers
<span class="pull-right text-muted small">12 min</span>
</div>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#">
<div>
<i class="fa fa-envelope fa-fw"></i> Message Sent
<span class="pull-right text-muted small">4 min</span>
</div>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#">
<div>
<i class="fa fa-tasks fa-fw"></i> New Task
<span class="pull-right text-muted small">4 min</span>
</div>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#">
<div>
<i class="fa fa-upload fa-fw"></i> Server Rebooted
<span class="pull-right text-muted small">4 min</span>
</div>
</a>
</li>
<li class="divider"></li>
<li>
<a class="text-center" href="#">
<strong>See All Alerts</strong>
<i class="fa fa-angle-right"></i>
</a>
</li>
</ul>
<!-- /.dropdown-alerts -->
</li>
<!-- /.dropdown -->
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
<i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><i class="fa fa-sign-out fa-fw"></i> Logout
</li>
</ul>
<!-- /.dropdown-user -->
</li>
<!-- /.dropdown -->
</ul>
</nav>
<!--/. NAV TOP -->
<nav class="navbar-default navbar-side" role="navigation">
<div id="sideNav" href=""><i class="fa fa-caret-right"></i></div>
<div class="sidebar-collapse">
<ul class="nav" id="main-menu">
<li>
<i class="fa fa-dashboard"></i> Dashboard
</li>
<li>
<i class="fa fa-user"></i> Missing Person Management
</li>
<li>
<i class="fa fa-plus"></i> Create Account</span>
</li>
<li>
<i class="fa fa-sitemap"></i> Manage Services <span class="fa arrow"></span>
<ul class="nav nav-second-level">
<li>
News
</li>
<li>
Contacts
</li>
</ul>
</li>
<li>
<a class="active-menu" href="#"><i class="fa fa-sitemap"></i> Transactions <span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li>
<<a class="active-menu" href="transac_pending.php"> Pending</a>
</li>
<li>
Verified
</li>
<li>
Rejected
</li>
</ul>
</li>
<li>
<i class="fa fa-file"></i> Reports
</li>
<li>
<i class="fa fa-history"></i> Audit Trail
</li>
</ul>
</div>
</nav>
<!-- /. NAV SIDE -->
<div id="page-wrapper" >
<div id="page-inner">
<div class="row">
<div class="col-md-12">
<h1 class="page-header">
Transaction Requests
</h1>
</div>
</div>
<!-- /. ROW -->
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<ol class="breadcrumb">
<li class="active">
<i class="fa fa-user"></i> List of Transaction Requests
</li>
</ol>
</div>
<div class="panel-body">
<div class="column" >
<tr>
<td>
<table class="table table-hover" border="2">
<col width="5%"></col>
<col width="15%"></col>
<col width="10%"></col>
<col width="10%"></col>
<col width="10%"></col>
<col width="15%"></col>
<col width="15%"></col>
<col width="10%"></col>
<thead>
<tr>
<center>
<th><center>Informant Name</th>
<th><center>Informant Address</th>
<th><center>Informant Contact</th>
<th><center>Informant Email</th>
<th><center>Sighted Person</th>
<th><center>Action</th>
</center>
</tr>
</thead>
<?php
include('mysql_connect.php');
$query="SELECT * from tbl_informant,tbl_missing_person where informant_status='Pending' and reported_id=mp_id";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
?>
<tr>
<td><center><?php echo $row['informant_fname'].' '.$row['informant_lname'];?></center></td>
<td><center>
<?php echo $row['informant_address'];?></center></td>
<td><?php echo $row['informant_contact']?></td>
<td><?php echo $row['informant_email']?></td>
<td>
<img src="<?php echo $row['mp_image_location'].$row['mp_image']?>" height=100 width=100><br>
<?php echo $row['mp_fname'].' '.$row['mp_lname']?>
</td>
<td>
<?php
$id=$row['informant_id'];
$_SESSION['id']=$id;
echo "<center>
<button type='button'class='btn btn-primary btn-sm?id=".$id."' data-toggle='modal' title='Confirm'data-target='#ModalConfirm'>
Confirm</button>
<button type='button'class='btn btn-danger btn-sm?id=".$id."' data-toggle='modal' title='Confirm'data-target='#ModalReject'>
Reject</button>
</center>"
?>
</td>
</tr>
<?php
}
?>
<!-- Modal for REJECT-->
<div class="modal fade" id="ModalReject" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title"><b>Rejecting Request:</h4></b>
</div>
<div class="modal-body">
<p>Reason/s: </p>
<textarea cols="75" rows="5" placeholder="Enter reason here.." name="transac_reason"></textarea>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Submit</button>
</div>
</div>
</div>
</div>
<!-- Modal for CONFIRM-->
<div class="modal fade" id="ModalConfirm" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-body">
<p>Are you sure you want to confirm request? </p>
<?php
$modalquery="select * from tbl_informant,tbl_missing_person,tbl_contact_person
where concat(reported_id=mp_id && mp_id=cp_id)";
?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" >Yes</button>
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /. PAGE INNER -->
</div>
<!-- /. PAGE WRAPPER -->
</div>
<!-- /. WRAPPER -->
<!-- JS Scripts-->
<!-- jQuery Js -->
<script src="assets/js/jquery-1.10.2.js"></script>
<!-- Bootstrap Js -->
<script src="assets/js/bootstrap.min.js"></script>
<!-- Metis Menu Js -->
<script src="assets/js/jquery.metisMenu.js"></script>
<!-- Morris Chart Js -->
<script src="assets/js/morris/raphael-2.1.0.min.js"></script>
<script src="assets/js/morris/morris.js"></script>
<!-- Custom Js -->
<script src="assets/js/custom-scripts.js"></script>
</body>
</html>
You can't execute a live mysql query like this to modify the table.
The best way for this is with ajax, you can catch the id if is on the table and use ajax to execute the mysql query.
I suggest you put the informant id in the value of a button in the table with a class:
<button class="id" data-target="modal" value="<?= $row['informant_id'] ?>"/>
and you can get the value of the button with a jquery event with this:
$(document).on("click", "id", function(){
var id = $(this).val();
console.log(id);
// and handle the value
});
this is one of many ways to pass the variable, if you just want to print it on the modal, create a tag with an id "example" <h1 id="example"></h1> inside the modal and execute this:
$(document).on("click", "id", function(){
var id = $(this).val();
console.log(id);
// and handle the value
$(".modal #example").text(id);
});
Regards.

Anchor links not working when I used it in include files in php

Im using include 'header.php' so i'll not repeat my header code all over again but I noticed it that the links inside the header.php are not working except the parent file the dashboard.php.
ALl the anchor tags inside the dashboard.php are working but not inside the header.php
This is my dashboard.php code
<?php require_once 'includes/header.php'; ?>
<!-- Setting the treeview active -->
<script type="text/javascript">
document.getElementById("treeview1").className = "active menu-open"
</script>
<!-- End Setting the treeview active -->
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Dashboard
<small>Version 2.0</small>
</h1>
<ol class="breadcrumb">
<li><i class="fa fa-dashboard"></i> Home</li>
<li><i class="fa fa-dashboard"></i> Question</li>
<li class="active">Dashboard</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<?php require_once 'includes/footer.php'; ?>
Heres the header.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>SOG Evaluation System</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.7 -->
<link rel="stylesheet" href="../assets/bower_components/bootstrap/dist/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="../assets/bower_components/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="../assets/bower_components/Ionicons/css/ionicons.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="../assets/dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="../assets/dist/css/skins/skin-green.css">
<!-- CLOCK rico -->
<script src="../assets/plugins/clock/ricoClock.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/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 class="hold-transition sidebar-mini skin-green"> <!-- set dito yung name ng theme -->
<div class="wrapper">
<header class="main-header">
<!-- Logo -->
<a href="dashboard.php" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>SOG</b></span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg">SOG Evaluation System</span>
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
<!-- Navbar Right Menu -->
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<!-- Messages: style can be found in dropdown.less-->
<li class="dropdown messages-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope-o"></i>
<span class="label label-success">4</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 4 messages</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- start message -->
<a href="#">
<div class="pull-left">
<img src="../assets/dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Support Team
<small><i class="fa fa-clock-o"></i> 5 mins</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<!-- end message -->
<li>
<a href="#">
<div class="pull-left">
<img src="../assets/dist/img/user3-128x128.jpg" class="img-circle" alt="User Image">
</div>
<h4>
AdminLTE Design Team
<small><i class="fa fa-clock-o"></i> 2 hours</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="../assets/dist/img/user4-128x128.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Developers
<small><i class="fa fa-clock-o"></i> Today</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="../assets/dist/img/user3-128x128.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Sales Department
<small><i class="fa fa-clock-o"></i> Yesterday</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="../assets/dist/img/user4-128x128.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Reviewers
<small><i class="fa fa-clock-o"></i> 2 days</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
</ul>
</li>
<li class="footer">See All Messages</li>
</ul>
</li>
<!-- Notifications: style can be found in dropdown.less -->
<li class="dropdown notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-bell-o"></i>
<span class="label label-warning">10</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 10 notifications</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li>
<a href="#">
<i class="fa fa-users text-aqua"></i> 5 new members joined today
</a>
</li>
<li>
<a href="#">
<i class="fa fa-warning text-yellow"></i> Very long description here that may not fit into the
page and may cause design problems
</a>
</li>
<li>
<a href="#">
<i class="fa fa-users text-red"></i> 5 new members joined
</a>
</li>
<li>
<a href="#">
<i class="fa fa-shopping-cart text-green"></i> 25 sales made
</a>
</li>
<li>
<a href="#">
<i class="fa fa-user text-red"></i> You changed your username
</a>
</li>
</ul>
</li>
<li class="footer">View all</li>
</ul>
</li>
<!-- User Account: style can be found in dropdown.less -->
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="../assets/dist/img/avatar.png" class="user-image" alt="User Image">
<span class="hidden-xs">Superadmin</span>
</a>
<ul class="dropdown-menu">
<!-- User image -->
<li class="user-header">
<img src="../assets/dist/img/avatar.png" class="img-circle" alt="User Image">
<p>
Superadmin - Web Developer
<small>Member since Nov. 2012</small>
</p>
</li>
<!-- Menu Body -->
<li class="user-body">
<div class="row">
<div class="col-xs-4 text-center">
Followers
</div>
<div class="col-xs-4 text-center">
Sales
</div>
<div class="col-xs-4 text-center">
Friends
</div>
</div>
<!-- /.row -->
</li>
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left">
Profile
</div>
<div class="pull-right">
Sign out
</div>
</li>
</ul>
</li>
<!-- Control Sidebar Toggle Button -->
</ul>
</div>
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<img src="../assets/dist/img/avatar.png" class="img-circle" alt="User Image">
</div>
<div class="pull-left info">
<p>Superadmin</p>
<i class="fa fa-circle text-success"></i> Online
</div>
</div>
<!-- search form -->
<!-- <form action="#" method="get" class="sidebar-form">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<button type="submit" name="search" id="search-btn" class="btn btn-flat">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</form> -->
<!-- /.search form -->
<div id="clockbox" style="font:12pt ; color:#ffffff;text-align: center;margin-bottom: 7px;padding: 10px"></div>
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu" data-widget="tree">
<li class="header">MAIN NAVIGATION</li>
<li class="treeview" id="treeview1">
<a href="dashboard.php">
<i class="fa fa-dashboard"></i> <span>Dashboard</span>
</a>
</li>
<li class="treeview" id="treeview2">
<a href="manageUsers.php">
<i class="fa fa-user"></i> <span>User Management</span>
</a>
</li>
<li class="treeview" id="treeview3">
<a href="manageQuestions.php">
<i class="fa fa-list-ul"></i> <span>Questionnaire Management</span>
</a>
</li>
<li class="treeview" id="treeview4">
<a href="manageSchedule.php">
<i class="fa fa-calendar"></i> <span>Evaluation Schedule</span>
</a>
</li>
<li class="treeview" id="treeview5">
<a href="viewResults.php">
<i class="fa fa-bar-chart"></i> <span>Evaluation Results</span>
</a>
</li>
<li class="treeview" id="treeview6">
<a href="generateReports.php">
<i class="fa fa-file-text"></i> <span>Reports</span>
</a>
</li>
<li class="treeview" id="treeview7">
<a href="manageSystemSettings.php">
<i class="fa fa-wrench"></i> <span>System Settings</span>
</a>
</li>
<li class="header">LABELS</li>
<li><i class="fa fa-circle-o text-red"></i> <span>Important</span></li>
<li><i class="fa fa-circle-o text-yellow"></i> <span>Warning</span></li>
<li><i class="fa fa-circle-o text-aqua"></i> <span>Information</span></li>
</ul>
</section>
<!-- /.sidebar -->
</aside>
All your links are empty. They are all <a href="#".
Then above href will make the browser go to top of page.
The way it should be used is <a href="#about".
And that will make the browser go to the about section (if there is an about id)
See this answer for a complete documentation of how it works.
What is href="#" and why is it used?
Guys I already found the error. The conflict is on my class, the treeview class on my sidebar-menu (header.php). I just removed it and it's working now.

php form to email, no working knowledge of PHP

I have no knowledge of PHP at all and am in desperate need of help. I have trawled the web for working examples but none of them are working for me. I need to send the data in the form to an email. I have 3 php files: index.php, contact.php and thank-you.php. Both the index and the contact page have forms on them and after sending the user is directed to the thank-you.php page. I am using localhost (MAMP) but i have also uploaded the website to this domain. Please tell me what I am doing wrong. The following code is located in the contact.php file:
<!DOCTYPE html>
<html lang="en">
<head>
<title> Legal Active - Contact Us </title>
<!-- Required meta tags always come first -->
<meta charset="utf-8">
<meta name="description" content="Index">
<meta name="keywords" content="personal inury specialist, accident,
accident claims, claim, personal injury, claim today,">
<meta name="author" content="Sukhvir Singh">
<meta name="viewport" content="width=device-width, initial-scale=1,
shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<!-- Bootstrap CSS -->
<link rel="stylesheet" type="text/css" href="../../css/main.css">
<!-- Animate.css -->
<link rel="stylesheet" type="text/css"
href="../../css/animate.css-master/animate.min.css">
<!-- Favicon -->
<link rel='shortcut icon' href='favicon.png' type='image/x-icon'/>
<script src="http://localhost:35729/livereload.js"></script>
</head>
<body>
<!-- Header Navbar -->
<nav class="navbar navbar-header-custom navbar-header-bg-custom">
<ul class="navbar-header-icon nav navbar-nav pull-md-left">
<li class="nav-item">
<a class="nav-link navbar-header-link hidden-dm-down"
href="#">
<i class="navbar-header-link__icon--lg fa fa-facebook" aria-hidden="true"></i>
</a>
</li>
<li class="nav-item">
<a class="nav-link navbar-header-link hidden-sm-down" href="https://twitter.com/search?src=typd&q=legal%20active%20ltd">
<i class="navbar-header-link__icon--lg fa fa-twitter" aria-hidden="true"></i>
</a>
</li>
<li class="nav-item">
<a class="nav-link navbar-header-link hidden-sm-down" href="#">
<i class="navbar-header-link__icon--lg fa fa-instagram" aria-hidden="true"></i>
</a>
</li>
</ul>
<ul class="nav navbar-nav pull-xs-right">
<li class="nav-item hidden-md-up">
<h5 class="navbar-header-link nav-link navbar-header-link--span"> Have a Question? </h5>
<a class="nav-link navbar-header-link" href="tel:01618852353"> Call us NOW
<i class="navbar-header-link__icon fa fa-phone" aria-hidden="true"> </i> 0161 885 2353
</a>
</li>
<li class="nav-item hidden-sm-down">
<h5 class="navbar-header-link nav-link navbar-header-link--lg--span"> Have a Question? </h5>
<a class="nav-link navbar-header-link navbar-header-link--lg" href="tel:01618852353"> Call us NOW
<i class="navbar-header-link__icon--lg fa fa-phone" aria-hidden="true"> </i> 0161 885 2353
</a>
</li>
</ul>
</nav>
<!-- Navbar -->
<nav class="navbar navbar-custom bg-custom">
<button class="navbar-toggler hidden-md-up" type="button" data-toggle="collapse" data-target="#exCollapsingNavbar4" aria-controls="exCollapsingNavbar2" aria-expanded="false" aria-label="Toggle navigation">
<i class="navbar__icon fa fa-bars" aria-hidden="true"></i>
</button>
<div class="collapse navbar-toggleable-sm" id="exCollapsingNavbar4">
<ul class="nav navbar-nav pull-xs-left col-xs-12">
<li class="nav-item active col-xs-12 col-md-2 offset-md-1">
<a class="nav-link" href="index.php"> HOME </a>
</li>
<li class="nav-item btn-group col-xs-12 col-md-3">
<div class="dropdown">
<button class="btn dropdown-toggle nav-link" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
TYPES OF CLAIMS
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="road-traffic-accident.html"> ROAD TRAFFIC ACCIDENTS </a>
<a class="dropdown-item" href="Slips-Trips-and-Falls.html"> SLIPS TRIPS & FALLS </a>
<a class="dropdown-item" href="accident-at-work.html"> ACCIDENT AT WORK <span class="sr-only">(current)</span> </a>
</div>
</div>
</li>
<li class="nav-item col-xs-12 col-md-3">
<a class="nav-link" href="work-with-us.html"> WORK WITH US </a>
</li>
<li class="nav-item col-xs-12 col-md-1">
<a class="nav-link" href="#"> CONTACT </a>
</li>
<li class="nav-item col-xs-12">
<a class="nav-link hidden-md-up" href="#">
<i class="nav-link__icon fa fa-facebook" aria-hidden="true"></i>
</a>
</li>
<li class="nav-item col-xs-12">
<a class="nav-link hidden-md-up" href="https://twitter.com/search?src=typd&q=legal%20active%20ltd">
<i class="nav-link__icon fa fa-twitter" aria-hidden="true"></i>
</a>
</li>
<li class="nav-item col-xs-12">
<a class="nav-link hidden-md-up" href="#">
<i class="nav-link__icon fa fa-instagram" aria-hidden="true"></i>
</a>
</li>
</ul>
</div>
</nav>
<div class="container">
<div class="row">
<div class="contact">
<h3 class="contact__h3"> CONTACT US </h3>
<div class="contact__divider"> </div>
<div class="contact__text col-xs-12 col-md-5">
Please use the form to tell us what you are enquiring about and somebody from our team will call you shortly.
</div>
<div class="contact__form form col-xs-12 col-md-5 offset-md-1">
<form class="form-group" id="contact__form" action="thank-you.php" method="POST">
<input type="text" class="input form-control fullName" placeholder="Full Name" name="fullName">
<input type="tel" class="input form-control number tel" placeholder="Contact Number" name="contactNumber">
<input type="text" class="input form-control email" placeholder="Email Address" name="email">
<textarea class="input col-xs-12 message" placeholder="Your Message" name="message"></textarea>
<button type="submit" class="form__btn btn btn-secondary"> SEND </button>
</form>
</div>
</div>
</div>
</div>
<!-- Footer -->
<div class="container-fluid">
<div class="container-fluid">
<div class="row">
<nav class="navbar bg-footer">
<ul class="nav navbar-nav footer__nav">
<img class="footer__nav__logo col-xs-4 col-md-4 col-lg-3 pull-xs-right pull-md-left" src="../../assets/legal-active-logo-large.png" alt="Logo"/>
<li class="footer__nav-item nav-item col-xs-12 col-md-5 pull-xs-right"> Legal Active</li>
<li class="footer__nav-item nav-item col-xs-12 col-md-5 pull-xs-right"> Magnus House, 8 Ashfield Road, Cheadle, Cheshire, SK8 1BB </li>
<li class="footer__nav-item nav-item col-xs-12 col-md-5 pull-xs-right"> Registered in England & Wales - Company No. 123 4567</li>
<li class="footer__nav-item nav-item col-xs-12 col-md-12 col-lg-5 pull-xs-right"> All Rights Reserved © Legal Active </li>
</ul>
</nav>
</div>
</div>
<!-- jQuery first, then Tether, then Bootstrap JS. -->
<script src="../../scss/bootstrap-4/js/tests/vendor/jquery.min.js"></script>
<script src="../../scss/bootstrap-4/js/tests/vendor/tether.min.js"></script>
<script src="../../scss/bootstrap-4/dist/js/bootstrap.min.js"></script>
<script src="../../js/custom-js.js"></script>
</body>
</html>
I have now removed the php code from contact.php to thank-you.php.
Here is the code located in than-you.php:
<?php
$to_mail = "sukhy87#me.com";
$mail_sent = 0;
if(isset($_POST['submit'])){
echo "the form was submitted";
$name = trim(strip_tags($_POST['fullName']));
if($name == "")
$error = true;
$email = trim(strip_tags($_POST['email']));
if($email == "")
$error = true;
$phone = trim(strip_tags($_POST['tel']));
$message = trim(strip_tags($_POST['message']));
if($error != true){
$header = 'From: "Legal Active Website" <no-replylegalactive.co.uk>'."\r\n";
$subject = "New Enquiry";
$message = "New Contact message, received from: <br /> \n ";
$message .= "<b>Name</b> ".$name."<br /> \n";
$message .= "<b>Email</b> ".$email."<br /> \n";
$message .= "<b>Phone</b> ".$phone."<br /> \n";
$message .= "<b>message</b> ".$message."<br /> \n";
if(#mail($to_mail,$subject,$message,$header))
{
echo "mail sent";
$mail_sent = 1;
}
else echo "mail not sent";
} else {
echo 'validation error';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title> Legal Active - Contact Us </title>
<!-- Required meta tags always come first -->
<meta charset="utf-8">
<meta name="description" content="Index">
<meta name="keywords" content="personal inury specialist, accident, accident claims, claim, personal injury, claim today,">
<meta name="author" content="Sukhvir Singh">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<!-- Bootstrap CSS -->
<link rel="stylesheet" type="text/css" href="../../css/main.css">
<!-- Animate.css -->
<link rel="stylesheet" type="text/css" href="../../css/animate.css-master/animate.min.css">
<!-- Favicon -->
<link rel='shortcut icon' href='favicon.png' type='image/x-icon'/>
<script src="http://localhost:35729/livereload.js"></script>
</head>
<body>
<!-- Header Navbar -->
<nav class="navbar navbar-header-custom navbar-header-bg-custom">
<ul class="navbar-header-icon nav navbar-nav pull-md-left">
<li class="nav-item">
<a class="nav-link navbar-header-link hidden-sm-down" href="#">
<i class="navbar-header-link__icon--lg fa fa-facebook" aria-hidden="true"></i>
</a>
</li>
<li class="nav-item">
<a class="nav-link navbar-header-link hidden-sm-down" href="https://twitter.com/search?src=typd&q=legal%20active%20ltd">
<i class="navbar-header-link__icon--lg fa fa-twitter" aria-hidden="true"></i>
</a>
</li>
<li class="nav-item">
<a class="nav-link navbar-header-link hidden-sm-down" href="#">
<i class="navbar-header-link__icon--lg fa fa-instagram" aria-hidden="true"></i>
</a>
</li>
</ul>
<ul class="nav navbar-nav pull-xs-right">
<li class="nav-item hidden-md-up">
<h5 class="navbar-header-link nav-link navbar-header-link--span"> Have a Question? </h5>
<a class="nav-link navbar-header-link" href="tel:01618852353"> Call us NOW
<i class="navbar-header-link__icon fa fa-phone" aria-hidden="true"> </i> 0161 885 2353
</a>
</li>
<li class="nav-item hidden-sm-down">
<h5 class="navbar-header-link nav-link navbar-header-link--lg--span"> Have a Question? </h5>
<a class="nav-link navbar-header-link navbar-header-link--lg" href="tel:01618852353"> Call us NOW
<i class="navbar-header-link__icon--lg fa fa-phone" aria-hidden="true"> </i> 0161 885 2353
</a>
</li>
</ul>
</nav>
<!-- Navbar -->
<nav class="navbar navbar-custom bg-custom">
<button class="navbar-toggler hidden-md-up" type="button" data-toggle="collapse" data-target="#exCollapsingNavbar4" aria-controls="exCollapsingNavbar2" aria-expanded="false" aria-label="Toggle navigation">
<i class="navbar__icon fa fa-bars" aria-hidden="true"></i>
</button>
<div class="collapse navbar-toggleable-sm" id="exCollapsingNavbar4">
<ul class="nav navbar-nav pull-xs-left col-xs-12">
<li class="nav-item active col-xs-12 col-md-2 offset-md-1">
<a class="nav-link" href="index.php"> HOME </a>
</li>
<li class="nav-item btn-group col-xs-12 col-md-3">
<div class="dropdown">
<button class="btn dropdown-toggle nav-link" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
TYPES OF CLAIMS
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="road-traffic-accident.html"> ROAD TRAFFIC ACCIDENTS </a>
<a class="dropdown-item" href="Slips-Trips-and-Falls.html"> SLIPS TRIPS & FALLS </a>
<a class="dropdown-item" href="accident-at-work.html"> ACCIDENT AT WORK <span class="sr-only">(current)</span> </a>
</div>
</div>
</li>
<li class="nav-item col-xs-12 col-md-3">
<a class="nav-link" href="work-with-us.html"> WORK WITH US </a>
</li>
<li class="nav-item col-xs-12 col-md-1">
<a class="nav-link" href="contact.php"> CONTACT </a>
</li>
<li class="nav-item col-xs-12">
<a class="nav-link hidden-md-up" href="#">
<i class="nav-link__icon fa fa-facebook" aria-hidden="true"></i>
</a>
</li>
<li class="nav-item col-xs-12">
<a class="nav-link hidden-md-up" href="https://twitter.com/search?src=typd&q=legal%20active%20ltd">
<i class="nav-link__icon fa fa-twitter" aria-hidden="true"></i>
</a>
</li>
<li class="nav-item col-xs-12">
<a class="nav-link hidden-md-up" href="#">
<i class="nav-link__icon fa fa-instagram" aria-hidden="true"></i>
</a>
</li>
</ul>
</div>
</nav>
<div class="container">
<div class="row">
<div class="submitMessage col-xs-12">
<h5 class="submitMessage__h5 h5"> THANK YOU </h5>
<p class="submitMessage__p p"> A member of our team will be in touch with you shortly </p>
<a class="submitMessage__link link" href="index.php"> Back to homepage </a>
</div>
</div>
</div>
<!-- Footer -->
<div class="container-fluid">
<div class="container-fluid">
<div class="row">
<nav class="navbar bg-footer">
<ul class="nav navbar-nav footer__nav">
<img class="footer__nav__logo col-xs-4 col-md-4 col-lg-3 pull-xs-right pull-md-left" src="../../assets/legal-active-logo-large.png" alt="Logo"/>
<li class="footer__nav-item nav-item col-xs-12 col-md-5 pull-xs-right"> Legal Active</li>
<li class="footer__nav-item nav-item col-xs-12 col-md-5 pull-xs-right"> Magnus House, 8 Ashfield Road, Cheadle, Cheshire, SK8 1BB </li>
<li class="footer__nav-item nav-item col-xs-12 col-md-5 pull-xs-right"> Registered in England & Wales - Company No. 123 4567</li>
<li class="footer__nav-item nav-item col-xs-12 col-md-12 col-lg-5 pull-xs-right"> All Rights Reserved © Legal Active </li>
</ul>
</nav>
</div>
</div>
<!-- jQuery first, then Tether, then Bootstrap JS. -->
<script src="../../scss/bootstrap-4/js/tests/vendor/jquery.min.js"></script>
<script src="../../scss/bootstrap-4/js/tests/vendor/tether.min.js"></script>
<script src="../../scss/bootstrap-4/dist/js/bootstrap.min.js"></script>
<script src="../../js/custom-js.js"></script>
</body>
</html>

Categories