Error with this Modify Header [duplicate] - php

This question already has answers here:
How to fix "Headers already sent" error in PHP
(11 answers)
Closed 7 years ago.
Just to give you a short background, I am working with a referral program and the main feature of it is referring someone.
In my website. I have registration page, login page, successful registration page, referral page and referral list.
For example, if you are a user, you have to register through registration page. If you successfully register on my page, the next page will be the successful registration page. There is a button there to go to the referral page to refer someone.
The problem I encounter is, I register as a new user. So definitely, I filled up all necessary information to registration page, after I successfully register, the next page after that is showing the successful registration page and in that page there is a button that once you click it, it will go to referral form page.
For example, I will now refer someone, so I filled up all information, so when I tried to submit my referral there is an error that prompt at my page
Can anyone tell me which line of my code is triggering this error:
Warning: Cannot modify header information - headers already sent by
(output started at
/home/thecommissioner/public_html/crm/include/Webservices/Utils.php:880)
in
/home/thecommissioner/public_html/crm/modules/Webforms/capture_old.php
on line 97
but the referral added on my referral list, so when I tried to refer again, this error won't show anymore... even if I refer several times, this error didn't show anymore. It just shows on the first referral try of a new created account. I don't know what the problem is.
This just shows on my first try to referring somebody, but after that, when I tried to refer more, this wont show anymore and I already added my referral. Can someone help me to figure this out?
I know there are several lessons there and I've already read different posts in stackoverflow about this and I'm still vague about it. And would you mind telling me what new code I can use instead of my current code? I cannot test if my page is working because of this.
Here's my code:
<!DOCTYPE html>
<?php
include('../include/dbconnection.php');
include('../include/functions.php');
if(!isset($_SESSION))
{
session_start();
}
$empid = $_SESSION['SESS_EMP_ID'];
$conid = $_SESSION['SESS_CONID'];
$fName = $_SESSION['SESS_FIRSTNAME'];
$lName = $_SESSION['SESS_LASTNAME'];
$contactNo = $_SESSION['SESS_CONTACT_NO'];
$mobile = $_SESSION['SESS_MOBILE'];
$email = $_SESSION['SESS_EMAIL'];
$bday = $_SESSION['SESS_BDAY'];
if($conid == '')
{
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.location.href='index.php';
</SCRIPT>");
}
else
{
//Nothing
}
?>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="../css/normalize.css">
<link rel="stylesheet" href="../css/skeleton.css">
<link rel="stylesheet" href="../css/successReg_style.css">
<link rel="icon" type="image/png" href="../images/cvglogo.png">
<link rel="short icon" href="../images/favicon.ico">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript"></script>
<link rel="stylesheet" href="../css/animate.css">
</head>
<body>
<!--Here the Header goes-->
<?php include('include/logoheader.php'); ?>
<!-- Overall Contect for Responsive Purposes-->
<div class="allcontent">
<div class="row">
<div class="twelve columns" style="margin-top:0%;">
<!-- Here the Main Content goes-->
<div="maincontent">
<center>
<h3>Congratulations and Welcome to the Circle!</h3>
<br>
<div class=" animated zoomIn socialmedia">
<ul>
<li>
<img class="logos" src="../images/tick.png">
</li>
</ul>
</div>
<!-- This is the welcome Introduction -->
<div class="welcome">
<p>Now that you’re part of the most awesome group on the planet, why not share the glory with your friends. There’s no happier
team
player than a team player with his friends.</p>
<span class="hit">Don’t be shy. Hit the button. Refer your friend!</span><br>
<!-- This is Just a GIF arrow down -->
<div class="demo-wrapper">
<div class="html5-dialog">
<div class="gif">
<img src="../images/scroll-down.gif">
</div>
<?php include('GlobalConstant.php'); ?>
<!-- But here goes the button for "I have someone in mind" -->
<a href="<?php echo employee_refer; ?>"><button class="navbutton">I have someone in mind</button>
</a>
</div>
</div>
</div>
</div>
</div>
<!-- Here the footer goes-->
<center><?php include("include/footer.php"); ?></center>
</body>
</html>
The error:
Warning: Cannot modify header information - headers already sent by
(output started at
/home/thecommissioner/public_html/crm/include/Webservices/Utils.php:880)
in
/home/thecommissioner/public_html/crm/modules/Webforms/capture_old.php
on line 97
just shows on my first attempt of referring then after that, when I referred more, the above warning/error didn't show again.
If those warning just shows on my first attempt of referring, why it doesn't show the next time I referring again? It just shows on my first try.

You need to send header before ANY output is sent. That means before that HTML, on top of page.
OR, as RamRider suggested, use output buffering.
Put
ob_start()
On very top of page and
ob_end_clean()
On very bottom

You need to put the session_start() function on top your code. Otherwise sometimes php will throw the exception headers already sent.
<?php
session_start();
include('../include/dbconnection.php');
include('../include/functions.php');
$empid = $_SESSION['SESS_EMP_ID'];
$conid = $_SESSION['SESS_CONID'];
$fName = $_SESSION['SESS_FIRSTNAME'];
$lName = $_SESSION['SESS_LASTNAME'];
$contactNo = $_SESSION['SESS_CONTACT_NO'];
$mobile = $_SESSION['SESS_MOBILE'];
$email = $_SESSION['SESS_EMAIL'];
$bday = $_SESSION['SESS_BDAY'];
if($conid == '')
{
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.location.href='index.php';
</SCRIPT>");
}
else
{
//Nothing
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="../css/normalize.css">
<link rel="stylesheet" href="../css/skeleton.css">
<link rel="stylesheet" href="../css/successReg_style.css">
<link rel="icon" type="image/png" href="../images/cvglogo.png">
<link rel="short icon" href="../images/favicon.ico">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript"></script>
<link rel="stylesheet" href="../css/animate.css">
</head>
<body>
<!--Here the Header goes-->
<?php include('include/logoheader.php'); ?>
<!-- Overall Contect for Responsive Purposes-->
<div class="allcontent">
<div class="row">
<div class="twelve columns" style="margin-top:0%;">
<!-- Here the Main Content goes-->
<div="maincontent">
<center>
<h3>Congratulations and Welcome to the Circle!</h3>
<br>
<div class=" animated zoomIn socialmedia">
<ul>
<li>
<img class="logos" src="../images/tick.png">
</li>
</ul>
</div>
<!-- This is the welcome Introduction -->
<div class="welcome">
<p>Now that you’re part of the most awesome group on the planet, why not share the glory with your friends. There’s no happier
team
player than a team player with his friends.</p>
<span class="hit">Don’t be shy. Hit the button. Refer your friend!</span><br>
<!-- This is Just a GIF arrow down -->
<div class="demo-wrapper">
<div class="html5-dialog">
<div class="gif">
<img src="../images/scroll-down.gif">
</div>
<?php include('GlobalConstant.php'); ?>
<!-- But here goes the button for "I have someone in mind" -->
<a href="<?php echo employee_refer; ?>"><button class="navbutton">I have someone in mind</button>
</a>
</div>
</div>
</div>
</div>
</div>
<!-- Here the footer goes-->
<center><?php include("include/footer.php"); ?></center>
</body>
</html>
If you are still experiencing the issue try ob_start() and ob_flush() .. Anyways this stackoverflow article about headers already sent is worth reading though Stackoverflow link

Related

Warning: Cannot modify header information Cant Fix [duplicate]

This question already has answers here:
How to fix "Headers already sent" error in PHP
(11 answers)
Closed 5 years ago.
I've already looked at a ton of fixes for this I've tried deleting whitespace but there was none, I've tried using the ob_start(); function but to no avail. Whatever I do it gives me this error.
Warning: Cannot modify header information - headers already sent by
(output started at /home/gener105/public_html/header.php:37) in /home/gener105/public_html/includes/vault_post.inc.php on line 12
It says the output starts on the last line of my header.php file(Fig1) and it has a problem with me calling header(); in the function I need to use. This is because of me using the header(); function on line 12 in vault_post.inc.php(Fig2).
I'm just confused on why its doing this because theres no outputs before the the header is called.
FIG1 (header.php)
<?php
session_start();
include 'includes/dbh.php';
include 'includes/vault_post.inc.php';
date_default_timezone_set('America/New_York');
?>
<!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="">
<title>Generation Diary - Leave Them Something For Later</title>
<!-- Bootstrap Core CSS -->
<link href="lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="lib/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Cabin:700" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
<!-- Theme CSS -->
<link href="css/grayscale.min.css" rel="stylesheet">
<!-- Temporary navbar container fix until Bootstrap 4 is patched -->
<style>
.navbar-toggler {
z-index: 1;
}
#media (max-width: 576px) {
nav > .container {
width: 100%;
}
}
</style>
</head>
FIG2 (vault_post.inc.php) The first function thats needed in the file
<?php
function setVaultPosts($conn) {
if (isset($_POST['vault_sub'])) {
$uid = $_POST['uid'];
$date = $_POST['date'];
$content = $_POST['content'];
$sql = "INSERT INTO vaults (uid, date0, content) VALUES ('$uid', '$date', '$content')";
$result = mysqli_query($conn, $sql);
header("Location: http://www.generationdiary.com/user_vault.php?success");
}
}
FORM THAT NEEDS THE FUNCTION
<?php include('header.php'); ?>
<div class="container" id="vault_main">
<div class="row row-offcanvas row-offcanvas-right">
<div class="col-12 col-md-9">
<p class="float-right hidden-md-up">
<button type="button" class="btn btn-primary btn-sm" data-toggle="offcanvas">Toggle nav</button>
</p>
<div class="jumbotron">
<h1 class="text-center">
<?php
if (isset($_SESSION['username'])) {
echo $_SESSION['firstname'] . " " . $_SESSION['lastname'] . "'s";
} else {
echo "You are not logged in";
}
?>
</h1>
<h2 class="text-center">Vault</h2> </div>
<?php
if (isset($_SESSION['username'])) {
echo "
<form action='".setVaultPosts($conn)."' method='POST'>
<input type='hidden' name='uid' value='".$_SESSION['username']."'>
<input type='hidden' name='date' value='".date(' Y-m-d ')."'>
<textarea class='ckeditor' name='content'></textarea>
<br>
<button class='btn btn-default btn-lg' type='submit' name='vault_sub'>Submit</button>
";
getVaultPosts($conn);
} else {
echo "log in";
}
?>
</div>
<div class="col-6 col-md-3 sidebar-offcanvas" id="sidebar">
<div class="fixed">
<div class="list-group"> Vault Recipient Settings Account Settings Log Out </div>
</div>
</div>
</div>
</div>
<?php include('footer.php'); ?>
This is entirely obvious. And your code is entirely flawed and this is probably because you are using HTML form submission for the first time.
Your header.php includes HTML text which is sent out immediately. So you want to call your Header() function, you need to make sure nothing is sent out before hand. You are having your session_start() on the first line of your code, this is correct and you need to make sure that this function is the first line of code in any PHP script processing that is using it. You need to be careful that no header info is sent before this function is called.
HTMl form's action attribute is the url path, not the PHP function.
<form action='form_process.php'>. You set the path here the same way you set link's href (relative or absolute path). Your form_process.php will then receive a $_POST global variable for you to handle your form data received. http://php.net/manual/en/reserved.variables.post.php

Cannot modify header information error? [duplicate]

This question already has answers here:
How to fix "Headers already sent" error in PHP
(11 answers)
Closed 5 years ago.
IK this is prob a dupe, but I cant find any solutions to my code what so ever, no matter what code i add/change, it just wont budge... (NOTE im not using normal php, using a friends version, which yes, is fine and dandy)
<?php
include($_SERVER['DOCUMENT_ROOT'].'/phpAlphaDB/core.php');
?>
<html>
<head>
<link rel="icon" type="image/png" href="../logo.png">
<title> Xenoz Web - Users </title>
<link rel="stylesheet" type="text/css" href="../css/style.php" />
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<?php
if ($role==0) {
header('Location: http://xenozweb.tk/index.php');
} else {
echo '<script>alert("Hello, '.$username.'. Welcome to the userlist...");</script>';
}
?>
<body>
<div class="navigation">
<div class="navitem"> Home </div>
<div class="navitem"> Register </div>
<div class="navitem"> Login </div>
<div class="navitem"> Users </div>
<div class="navitem"> Jukebox </div>
</div>
</div>
<div class="pagecontent">
<div class="userblock">
<?php
$results = db_read('xenozweb-users', '', 'username');
foreach ($results as $result) {
$u_name = db_column($result, 0);
echo '<div class="users">',$u_name,'</div>';
}
?>
</div>
</div>
</body>
</html>
You're returning a partial response before you set the header. Headers must be sent before a response is sent back to the browser.
Try moving the header('Location: ') function call into the top <?php enclosure like so:
<?php
include($_SERVER['DOCUMENT_ROOT'].'/phpAlphaDB/core.php');
if ($role==0) {
header('Location: http://xenozweb.tk/index.php');
}
?>
<html>
<head>
<link rel="icon" type="image/png" href="../logo.png">
<title> Xenoz Web - Users </title>
<link rel="stylesheet" type="text/css" href="../css/style.php" />
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<?php
if ($role != 0) {
echo '<script>alert("Hello, '.$username.'. Welcome to the userlist...");</script>';
}
?>
</head>
<body>
You've already sent data to the browser. you cannot send header() info properly once you've already started to send data payload.

PHP relocation header not working [duplicate]

This question already has answers here:
How to fix "Headers already sent" error in PHP
(11 answers)
Closed 7 years ago.
I have programmed a web application, which requires you to login first, before having access to the actual content of the application.
I am setting the value 'logedIn' to false when a user enters the homepage like this:
<?php
$_SESSION['logedIn'] = "false";
?>
If the user tries to go to overview.php, the code checks if the value of logedIn equals 'true'. If it is not, a header relocates the window to the login page like this:
<?php
session_start();
?>
<html>
<head>
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="https://jquery-ui.googlecode.com/svn-history/r3982/trunk/ui/i18n/jquery.ui.datepicker-nl.js"></script>
<script src="../javascript/overview.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/mainpage.css">
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
</head>
<body>
<?php
if($_SESSION['logedIn'] != "true") {
header("Location: ../index.php");
exit();
}
?>
<div class="container-fluid z-container">
<div class="row z-overview-top-menu">
<div class="col-md-2 z-background-dark z-top-nav z-border-right" id="menu_logo">
<h3>Logo</h3>
</div>
<div class="col-md-2 z-top-nav z-item-hover z-border-right z-selected" id="menu_diary" onclick="changeMenu('diary')">
<h3>Dagboek</h3>
</div>
<div class="col-md-2 z-top-nav z-item-hover z-border-right" id="menu_pazo" onclick="changeMenu('pazo')">
<h3>Pazo</h3>
</div>
<div class="col-md-2 z-top-nav z-item-hover z-border-right" id="menu_counter" onclick="changeMenu('counter')">
<h3>Tellers</h3>
</div>
<div class="col-md-2 z-top-nav z-item-hover z-border-right" id="menu_overview" onclick="changeMenu('overview')">
<h3>Overzicht</h3>
</div>
<div class="col-md-2 z-top-nav z-item-hover" id="menu_comparison" onclick="changeMenu('comparison')">
<h3>Vergelijking</h3>
</div>
</div>
<div class="row">
<div class="col-md-2 z-overview-left-menu">
<ul class="z-left-list" id="userList"></ul>
</div>
<div class="col-md-10 z-overview-main-menu">
<ul id="overviewList" class="z-overview-list-main">
</ul>
</div>
</div>
</div>
</body>
When I replace the header with an echo, I get a response, indicating that the header is indeed executing when I run the code.
Also there are no .htaccess in any of the directories.
Any thoughts on what the problem might be?
http://php.net/manual/en/function.header.php
Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.
Since you are outputting:
<html>
<head>
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="https://jquery-ui.googlecode.com/svn-history/r3982/trunk/ui/i18n/jquery.ui.datepicker-nl.js"></script>
<script src="../javascript/overview.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/mainpage.css">
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
</head>
<body>
before the header call, it will fail.

Trying to create indicator of relay on website

I'm having trouble with creating some sort of indicator on a webpage.
This should show me if something is turned on or off.
My project concerns on making a "automatic" terrarium controller, with sensors, relays and a raspberry. I'm able to show the sensor readings on a website, updating every minute (using jQuery).
At certain times, some relays are activated (which still has to be done, relay arrived today) and I want to see on the site if relay 1 is activated or not and again, updated automatically when this changes. The program to activate some relays is in python, and will also write a txt-file, containing a "0" or a "1" (for "off" and "on").
Then, using for instance a switch (e.g. switch) which should show the state of the relay, according to the txt file.
But, I don't seem to get it working.
Using PHP If and Else statements, ends up showing both even when using simple images as "indicators" of the relay.
<?php
$myfile = fopen("./statusUV.txt", "r") or die("Unable to open file!");
$status= fread($myfile);
if ($status == 1){
print ('<img src=./images/on.png />');
}
else{
print ('<img src=./images/on.png />');
}
But, how can different div's been shown, in case of this switch?
Oh, and I have to say, I'm new to PHP, HTML, Python, jQuery etc.
The "button" doesn't have to be clickable, it just have to show the state of the relay (or the output in the file).
If more information is needed, please, let me know!
Thanks in advance!
<!DOCTYPE HTML>
<html>
<head>
<title>UV</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700' rel='stylesheet' type='text/css'>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="js/skel.min.js"></script>
<script src="js/skel-panels.min.js"></script>
<script src="js/init.js"></script>
<noscript>
<link rel="stylesheet" href="css/skel-noscript.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/style-desktop.css" />
</noscript>
<?php
$myfile = fopen("./statusUV.txt", "r") or die("Unable to open file!");
$status= fread($myfile);
fclose($myfile);
switch(intval($status)){
case 0 : $img = "<img src='./images/off.png' />"; break;
default : $img = "<img src='./images/on.png' />";break;
}
?>
</head>
<body class="left-sidebar">
<!-- Wrapper -->
<div id="wrapper">
<!-- Header -->
<div id="header">
<div class="container">
<!-- Nav -->
<nav id="nav">
<ul>
<li class="active">Data</li>
<li>UV timer</li>
<li>Heat Timer</li>
<li>Led Timer</li>
<li>Sproeier Timer</li>
<li>Apparaten</li>
</ul>
</nav>
</div>
<div id="logo-wrapper">
<div class="container">
<!-- Logo -->
<div id="logo">
<h1>Timer<span class="tagline"> voor Sproeier</span></h1>
</div>
</div>
</div>
</div>
<!-- /Header -->
<!-- Main -->
<div id="main-wrapper">
<div class="divider"> </div>
<div id="main">
<div class="container">
<div class="row">
<div id="sidebar" class="4u">
<?php
if (isset($img)){
echo $img;
echo $status;
}?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="divider"> </div>
<!-- /Wrapper -->
<div id="copyright">
<div class="container">
<p style="font-size:11px">Design: TEMPLATED Images: Unsplash (CC0)</p>
</div>
</div>
</body>
</html>
Assume the var $status = 1 or 0 in the text file.
Your code must be like that :
<html>
<head>
<?php
$myfile = fopen("./statusUV.txt", "r") or die("Unable to open file!");
$status = fread($myfile);
fclose($myfile);
switch(intval($status)){
case 1 : $img = "<img src='./images/on.png' />"; break;
default : $img = "<img src='./images/off.png' />"; break;
}
?>
</head>
<body>
<?php
if (isset($img)){
echo $img;
}?>
</body>
</html>
Some PHP-problems has been solved by reseting the server. Apparently that would fix the strange code appearing on the site.
Now, after testing various things, it appears that $status remains empty. After trying various techniques, I found that fgets($myfile) would do the trick, instead of the fread($myfile)! Thanks everyone for helping!

Why would javascript not work when the page is fully rendered but works when I get fatal PHP errors?

I've been attempting to use jquery and jqueryui to make tabs on my website. However, I can't seem to get them to work. The main page is in PHP, and I am using the Codeigniter framework. If the page fully renders, then the tabs won't work. If I change something that creates a fatal error in the php the tabs appear. While I was attempting to figure out what was going on I created a very basic page with only the jquery demo script, and it wouldn't work either. If it makes any difference, I am hosting on HostGator.
Please advise.
Header:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Sign Up!</title>
<link rel="stylesheet" href="<?php echo base_url();?>css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo base_url();?>css/jquery-ui-1.8.11.custom.css" type="text/css" media="screen" />
<!-- Java includes -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js" type="text/javascript"></script>
</head>
<body>
<div class = "header">
<span class="nav_bar"><?php if($this->session->userdata('is_logged_in')){ echo 'Welcome, ' . ucfirst($this->session->userdata('first_name')). " " . ucfirst($this->session->userdata('last_name')) . ' | ' . anchor('site/logout' , 'Logout');} else { echo anchor('site/is_logged_in', 'Login');} ?></span>
</div>
<div class="content">
Body:
<!-- Tab Script -->
<script>
$(function() {
$( "#tabs" ).tabs();
});
</script>
<!-- end Tab Script -->
<div id="tabs">
<ul>
<li>All Contacts</li>
<li>Place Holder Tab</li>
</ul>
<div id="tabs-1">
<?php $this->load->view('all_contacts_tab_view'); ?>
</div>
<div id="tabs-2">
Place Holder tab
</div>
</div>
Footer:
</div> <!-- end content div -->
<div class="footer">
<div class="footer_left">
<div id="copyright"> © 2011 NetworkIgniter. All rights reserved. NetworkIgniter, networkigniter.com and the all designs are trademarks of NetworkIgniter. Created with CodeIgniter and hosted on HostGator.</div>
<div id="legal">Terms and Conditions | Privacy Policy</div>
<div id="benchmarking">{elapsed_time} | {memory_usage}</div>
</div>
</div>
</body>
</html>
I did track down a java error after all, but I'm not sure how to fix it.
Error: $("#tabs").tabs is not a function
Line: 23
it looks like your calling tabs before it generated I would put that in doc ready
$(document).ready(function() {
$( "#tabs" ).tabs();
});
Figured it out.
It was the Google tracking script at the end. It was claiming the $. the reason why it was working when php crashed was because it wasn't getting down to the footer where the Google script was.
Errors on tabs are often due to a missing end of tag such as a </div> or </li> or whatever. Check the code generated by the PHP script to see if everything's fine. You might wanna use the Developper Tools Plugin on FireFox to detect any validation problems (including the missing tags).

Categories