previous page (added as edit)
<!DOCTYPE html>
<html lang="en">
<head>
<script src="jquery-2.1.1.min.js"></script>
<script src="jquery/jquery-ui-1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="jquery/jquery-ui-1.11.2/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="bootstrap-3.3.1-dist/dist/css/bootstrap-theme.css">
<link rel="stylesheet" type="text/css" href="bootstrap-3.3.1-dist/dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css" href="bootstrap-3.3.1-dist/dist/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="bootstrap-3.3.1-dist/dist/css/bootstrap.min.css">
<script src="bootstrap-3.3.1-dist/dist/js/bootstrap.js"></script>
<script src="bootstrap-3.3.1-dist/dist/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="/CSS/handover.css">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>IgG Dashboard</title>
<script>
$(document).ready(function() {
// Datepicker Popups calender to Choose date.
$(function() {
$("#datepicker").datepicker({ dateFormat: 'yy-mm-dd' });
});
});
</script>
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="../../assets/js/ie-emulation-modes-warning.js"></script>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" 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="Dashboard.php">IgG Dashboard</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>Messages</li>
<li>Scripts and Options Editor</li>
<li>Add User</li>
<li id= "dash"><p >Welcome <?php echo " " .$_SESSION['myuser']." ";?><a class="btn bg-info" href="Dashboard.php">Main Site</a></p></li>
</ul>
</div><!-- /.nav-collapse -->
</div><!-- /.container -->
</div><!-- /.navbar -->
<div class="jumbotron">
<div class="container-fluid">
<br>
<br>
<br><br>
<?php
$scripte = ($_POST["scriptake"]);
$scriptot =($_POST["scriptot"]);
include 'config.php';
echo '<h2>'.$scripte.' Equipment</h2>';
echo '<h2>Total Hours '.$scriptot.'</h2>';
echo'<table class="table table-responsive"><tr><form action="equiptest.php" method="post"><th>Script Hour</th><th>Equipment Required</th><th>Stage</th></tr>';
$x = 1;
$p = 1;
$r=1;
while($x <= $scriptot ) {
echo "<tr><td>".$x++."</td><td><input name='equip".$r++."'` ></td><td><input name='stage".$p++."'><input name='ohyeah' type='hidden' value= '".$scriptot."'></td></tr>";
}
echo'<tr><td colspan="2"><input type="submit" class="btn btn-primary"></td></tr></form></table>';
?>
</div>
Can I do this with a post variable. I get undefined. However if I write
equip1 = ($_POST["equip1"]);
echo $equip1;
it works
<?php
$scriptot = ($_POST["ohyeah"]);// working
$y = 1;
$x = 1;
$r= 1;
while($x <= $scriptot ) {//working
${"equip".$x} = ($_POST["equip".$x]); //not working
echo ${"equip" .$x};//not working
$x++; // working
}
I am trying to create dyanmic variables. Idea in this case is to insert POST to database
so want
$equip1
$equip2
$equip3 etc
Thanks
For organizational purposes, you should really use arrays.
For instance, in a form you can set the input name to 'equip[1]' and the value will imported to PHP as $_POST['equip'][1]. Then you can just run:
foreach($_POST['equip'] as $key=>$value) {
# where $key = 1, the $value will be of equip[1]
}
May not be exactly what you're after, but it seems like a much cleaner solution than what you are attempting.
This is how I try.
<?php while ( have_posts() ) : the_post(); ?>
<div class="contentTitle"><?php the_title(); ?></div>
<div class="contentText">
<?php the_content(); ?>
</div>
<?php endwhile ?>
Related
I'm trying to figuring out what the problem but I can't.
Basically I have the index.php with a login to an admin area and admin.php that Is the main page of the admin area.
If I remove the SESSION from the admin.php page the login itself works but I can reach the page admin.php without logging into index, but if I add the SESSION to admin.php after the login it goes straight to the else at the end of the admin.php page.
For sure I'm failing something with the SESSION but I don't know what.
Index.php
<!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 http-equiv="x-ua-compatible" content="ie=edge">
<link rel="icon" type="image/png" href="images/favico.png">
<title>eWaste</title>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Material Design Bootstrap -->
<link href="css/mdb.min.css" rel="stylesheet">
<!-- Your custom styles (optional) -->
<link href="css/style.css" rel="stylesheet">
<style>
html{
margin-top: 100px;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light grey lighten-5 fixed-top">
<div class="container">
<a class="navbar-brand" href="../index.php">
<img src="../images/logo.png" height="30" class="d-inline-block align-top" alt="">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarResponsive">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" id="navi-current" href="index.php">Admin</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Navbar -->
<!--Main-->
<main class="mb-4 pb-5">
<div class="container">
<div class="row">
<div class="col-xl-4 col-lg-4 col-md-3"></div>
<div class="col-xl-4 col-lg-4 col-md-6">
<form class="text-center border border-light p-5" method="post" name="">
<p class="h4 mb-4">Sign in</p>
<!-- Email -->
<input type="text" id="materialContactFormUsername" class="form-control" placeholder="User" name="formuser">
<!-- Password -->
<input type="password" id="defaultLoginFormPassword" class="form-control mb-4" placeholder="Password" name="formpass">
<!-- Login button -->
<button class="btn btn-info btn-block my-4" type="submit" name="submit">Sign in</button>
</form>
</div>
<div class="col-xl-4 col-lg-4 col-md-3"></div>
</div>
</div>
</main>
<!--/.Main-->
<?php
if (isset($_POST['submit']))
{
include 'conn.php';
session_start();
$user = $_POST['formuser'];
$pass = $_POST['formpass'];
$query = mysqli_query($conn, "SELECT user FROM login WHERE user='$user' and pass='$pass'");
if (!$query) {
die('Invalid query: ' . mysqli_error());
}
if (mysqli_num_rows($query) != 0){
$_SESSION['login_user']=$username;
header("Location: admin.php");
}
else{
echo "<script type='text/javascript'>alert('User Name Or Password Invalid!')</script>";
}
mysqli_close($conn);
}
?>
<!--Footer-->
<?php include 'footer.php';?>
<!--/.Footer-->
<!-- SCRIPTS -->
<!-- JQuery -->
<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="js/mdb.min.js"></script>
<!-- Initializations -->
<script type="text/javascript">
// Animations initialization
new WOW().init();
</script>
</body>
Admin.php
<?php
if (isset($_SESSION['login_user'])){
session_start();
echo "ok";
?>
<!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 http-equiv="x-ua-compatible" content="ie=edge">
<link rel="icon" type="image/png" href="images/favico.png">
<title>eWaste</title>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Material Design Bootstrap -->
<link href="css/mdb.min.css" rel="stylesheet">
<!-- Your custom styles (optional) -->
<link href="css/style.css" rel="stylesheet">
<style>
html{
margin-top: 100px;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light grey lighten-5 fixed-top">
<div class="container">
<a class="navbar-brand" href="../index.php">
<img src="../images/logo.png" height="30" class="d-inline-block align-top" alt="">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarResponsive">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" id="navi-current" href="index.php">Admin</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Navbar -->
<!--Main-->
<main class="mb-4 pb-5">
<div class="container">
<div class="row">
<div class="col-xl-4 col-lg-4 col-md-3"></div>
<div class="col-xl-4 col-lg-4 col-md-6">
</div>
<div class="col-xl-4 col-lg-4 col-md-3"></div>
</div>
</div>
</main>
<!--/.Main-->
<!--Footer-->
<?php include 'footer.php';?>
<!--/.Footer-->
<!-- SCRIPTS -->
<!-- JQuery -->
<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="js/mdb.min.js"></script>
<!-- Initializations -->
<script type="text/javascript">
// Animations initialization
new WOW().init();
</script>
</body>
</html>
<?php
}
else{
echo "no";
exit();
}
?>
Please try to place this code
<?php
if (isset($_POST['submit']))
{
include 'conn.php';
session_start();
$user = $_POST['formuser'];
$pass = $_POST['formpass'];
$query = mysqli_query($conn, "SELECT user FROM login WHERE user='$user' and pass='$pass'");
if (!$query) {
die('Invalid query: ' . mysqli_error());
}
if (mysqli_num_rows($query) != 0){
$_SESSION['login_user']=$username;
header("Location: admin.php");
}
else{
echo "<script type='text/javascript'>alert('User Name Or Password Invalid!')</script>";
}
mysqli_close($conn);
}
?>
At the Start of the page. You can not assign value into the session if you print something on browser. It will give you warnings.
I made this simple calender for a few friends to fill in all their dates, It all works fine when you update the dates but then when you go back to the calendar it shows all the old dates selected. You have to manually refresh the page to get the updated dates it's really frustrating.
You can demo it here: http://olli460.com/poker/index.php
If you click "Add/Edit Dates" then click on "oliver" and select a few random dates. When you go back to the calendar it's still showing all the old dates until you press F5.
This is my index.php
<?php
date_default_timezone_set('Europe/London');
//error_reporting(E_ALL);
$pageWeb = $_REQUEST['page'];
$pageWeb = filter_var($pageWeb, FILTER_SANITIZE_STRING);
if(empty($pageWeb)) {
$pageWeb = "main";
}
$mysqli = mysqli_connect("localhost","xxxxx","xxxxxx","xxxxxx") or die("Error " . mysqli_error($link));
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Poker Calendar</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="mobile-web-app-capable" content="yes">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.0.47/jquery.fancybox.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.0.47/jquery.fancybox.min.js"></script>
<link rel="shortcut icon" sizes="192x192" href="if_icon-82_667352.png">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<!--<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">-->
<link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Arvo:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="theme.css">
<link rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
</head>
<body>
<script src="https://use.fontawesome.com/8a36931ffe.js"></script>
<div class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
Poker Calendar
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#navbar-main">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="navbar-main">
<ul class="nav navbar-nav">
<li <?php if(empty($pageWeb)) { echo "class=\"active\""; } ?>><i class="fa fa-calendar" aria-hidden="true"></i> Calendar</li>
<li <?php if(empty($pageWeb) OR $pageWeb == "add-dates") { echo "class=\"active\""; } ?>><i class="fa fa-calendar-plus-o" aria-hidden="true"></i> Add/Edit Dates</li>
<li <?php if(empty($pageWeb) OR $pageWeb == "add-player") { echo "class=\"active\""; } ?>><i class="fa fa-user-plus" aria-hidden="true"></i> Add Player</li>
</div>
</div>
</div>
<div class="clearfix"></div>
<br /><br /><br /><br />
<div class="container-fluid">
<!-- START ALL CONTENT HERE -->
<?php
if(isSet($pageWeb)){
if (!(strpos($pageWeb, "http") === false)){
echo "not allowed";
}else{
include("$pageWeb.php");
}
} else {
include("main.php");
}
?>
<!-- END ALL CONTENT HERE -->
</div>
</body>
</html>
After they enter the dates i'm using this to redirect back to the main page, is this the issue?
<script>
$(document).ready(function () {
// Handler for .ready() called.
window.setTimeout(function () {
location.href = "index.php";
}, 3000);
});
</script>
if you want to fix that script, tell the browser not to cache the page:
<?php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>
and why load data from mySQL? maybe use the Google Client Library (GitHub) instead?
I want to fetch records from database in category field with a button next to it, and when I click on that button there is a bootstrap collapse on which I have to display records from another database which is the sub-category of that specific category field and it should dynamically fetch the records as per above category field., and will be keep on changing when changes done from admin side. I want to write PHP code in SQL query, below code shows no error but does not provides me the expected outcome. Please Help me friends.
<?php
$conn = mysqli_connect("localhost","root","","zuuvee");
$query = mysqli_query($conn, "SELECT * FROM category_name");
$query1 = mysqli_query($conn, "SELECT * FROM subcategory_name WHERE category = 'Apparel & Accessories'");
?>
<!DOCTYPE html>
<html>
<head>
<title>Category</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
</head>
<body>
<?php
while ($row = mysqli_fetch_array($query))
{
?>
<ul>
<li>
<span class="number"><?php echo $row['ID']; ?></span>
<span><a class="btn btn-primary" data-toggle="collapse" href="#third<?php echo $row['ID']; ?>" aria-expanded="false"></a>
<span><label name ="lb1"><?php echo $row['name']; ?></label></span>
<div class="collapse" id="third<?php echo $row['ID']; ?>">
<div class="card" style="width: 18rem;">
<div class="card-body">
<?php
while ($row1 = mysqli_fetch_array($query1))
{
?>
<h5 class="card-title"><?php echo $row1['subcategory']; ?></h5>
<?php
}
?>
</div>
</div>
</div></span>
<span class="points">00</span>
<span class="badge"><i class= "fa fa-microchip" aria-hidden="true"></i></span>
</li>
</ul>
<?php
}
?>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
</body>
</html>
In error log, i get error on line 7 and 109 of header.php which says "on line 7 Undefined index: id in /var/www/ttm.com/public_html/include/header.php" and "Undefined index: fullname in /var/www/ttm.com/public_html/include/header.php on line 109". This same code was working fine before the upgrade.
Here is my code of header.php
<?php
include('data/db.php');
$base_url = "http://ttm.xceedance.com/";
if(!isset($_SESSION['login'])){
header("Location:login.php");
}
$user_id=$_SESSION['id'];
$sql_works = "select * from items where work_status!='Start' AND account_id='$user_id'";
$result_works = mysql_query($sql_works);
$acco_data=mysql_fetch_array($result_works);
if(!empty($acco_data))
{
$account_work_status=$acco_data['work_status'];
}
else
{
$sql_mett = "select * from meeting where work_status!='Start' AND account_id='$user_id'";
$result_mett = mysql_query($sql_mett);
$acco_mett=mysql_fetch_array($result_mett);
if(empty($acco_mett))
{
$sql_client = "select * from client_email where work_status!='Start' AND account_id='$user_id'";
$result_client = mysql_query($sql_client);
$acco_client=mysql_fetch_array($result_client);
if(empty($acco_client))
{
$sql_break = "select * from break where work_status!='Start' AND account_id='$user_id'";
$result_break = mysql_query($sql_break);
$acco_break=mysql_fetch_array($result_break);
if(!empty($acco_break))
{
$account_work_status=$acco_break['work_status'];
} else { $account_work_status='Start'; }
}
else
{
$account_work_status=$acco_client['work_status'];
}
}
else
{
$account_work_status=$acco_mett['work_status'];
}
}
//print_r($account_work_status);die;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="120" >
<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>Xceedance Exposure Management Time Tracker</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/sb-admin.css" rel="stylesheet">
<link href="css/mystyle.css" rel="stylesheet">
<link href="css/jquery-ui.css" rel="stylesheet">
<!-- Morris Charts CSS -->
<link href="css/plugins/morris.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/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>
<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>
<html><body><div id="image" style="float:left;"><?php if($account_work_status=='Start') { ?><a href="index.php"><?php } else { ?><a href="#workstatus_modal" data-toggle="modal"><?php } ?><img src="/images/logo.png"/></div></body></html>
<html><?php if($account_work_status=='Start') { ?><a class="navbar-brand" href="index.php"><?php } else { ?><?php } ?>Exposure Management Time Tracker<html>
</div>
<!-- Top Menu Items -->
<ul class="nav navbar-right top-nav">
<li class="dropdown">
<i class="fa fa-user"></i> Welcome <?php echo $_SESSION['fullname'] ?> <b class="caret"></b>
<ul class="dropdown-menu">
<li>
<i class="fa fa-fw fa-gear"></i> Settings
</li>
<li>
<i class="fa fa-fw fa-gear"></i>Change Password
</li>
<li class="divider"></li>
<li>
<?php if($account_work_status=='Start') { ?> <?php } else { ?><a href="#workstatus_modal" data-toggle="modal"><?php } ?><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 -->
We set up our website and it displays fine in localhost but displays
this
when it's uploaded online. There are no errors in the console and the files are arranged fine. Honestly, I don't know where the problem is, I just assumed its within the code since everything else below include 'templates/header.php' is not displayed.
Here is a sample of my code for index.php
<?php
session_start();
include 'templates/header.php';
include 'library/announcements.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Resources for the Blind, Inc. Website 2017">
<meta name="author" content="Platinum Phenomena">
<title>Resources for the Blind, Inc.</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/animate.css">
<link rel="stylesheet" type="text/css" href="css/responsive.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">
</script>
<script src="script.js"></script>
<!-- Google CDN jQuery with fallback to local -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"
</script>
<script>window.jQuery || document.write('<script src="js/minified/jquery-1.11.0.min.js"><\/script>')
</script>
try{
if( !file_exists("library/announcements.php") )
{ throw new Exception("Unable to include resources announcements"); }
else{ require_once("library/announcements.php"); }
}catch(Exception $e){
echo $e->getMessage();
exit;
}
?>
<header id="header" role="banner">
<div class="main-nav">
<div class="container">
<div class="header-top">
<div class="pull-right social-icons">
<img src="images/fb.png">
<img style="width:40px; height:40px;" src="images/yt.png">
<img src="images/ig.png">
<img src="images/twitter.png">
</div>
</div>
<div class="row">
<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="index.php">
<img class="img-responsive" src="images/logo.jpg" height="8" alt="logo">
</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="scroll active">
Home
</li>
<li class="scroll">
Activities
</li>
<li class="scroll">
About Us
</li>
<li class="scroll">
Partners
</li>
<li class="scroll">
Contact
</li>
</ul>
</div>
</div>
</div>
</div>
</header>
Please include files after the head section in your case and try like below given
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Resources for the Blind, Inc. Website 2017">
<meta name="author" content="Platinum Phenomena">
<title>Resources for the Blind, Inc.</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/animate.css">
<link rel="stylesheet" type="text/css" href="css/responsive.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">
</script>
<script src="script.js"></script>
<!-- Google CDN jQuery with fallback to local -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"
</script>
<script>window.jQuery || document.write('<script src="js/minified/jquery-1.11.0.min.js"><\/script>')
</script>
</head>
<body>
<?php
try{
if( !file_exists("templates/header.php") )
{ throw new Exception("Unable to include resources header"); }
else{ require_once("templates/header.php"); }
}catch(Exception $e){
echo $e->getMessage();
exit;
}
try{
if( !file_exists("library/announcements.php") )
{ throw new Exception("Unable to include resources announcements"); }
else{ require_once("library/announcements.php"); }
}catch(Exception $e){
echo $e->getMessage();
exit;
}
?>
</body>
</html>
I found out that it was a problem with connecting to the database. I forgot to check the db configurations. If someone else encounters this problem, please let me know. Thank you so much to everyone who tried to help! Much appreciated.