ecabrera Posted August 7, 2011 Share Posted August 7, 2011 i need help will this when i reload a page nothing appears help <?php ini_set( 'display_errors', 1 ); error_reporting( -1 ); date_default_timezone_set('America/Los_Angeles'); session_start(); $username = $_SESSION['username']; $userid = $_SESSION['userid']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php echo "$title";?></title> <link href='styles/main.css' rel='stylesheet' type='text/css'></link> <script language="javascript" src="scripts/javascript.js"></script> <?php require("scripts/functions.php"); ?> <style type='text/css'> <!-- body{ background-color: Purple; } --> </style> </head> <body> <div id='wrapper'> <div id='header'> <div id='status'><?php require('scripts/status.php'); ?></div> <a href='<?php echo $site?>'><img src='images/logo.png'></img></a> </div> <?php if ($username) //login in user see this <div id='nav'> <a href='<?php echo $site;?>/videos'>Videos</a> <a href='<?php echo $site;?>/videos'>Videos</a> <a href='<?php echo $site;?>/movies'>Movies</a> </div> } else { //not login memebr see this <div id='nav'> <a href='<?php echo $site;?>/videos'>Videos</a> <a href='<?php echo $site;?>/movies'>Movies</a> </div> } ?> <div id='content'> Quote Link to comment https://forums.phpfreaks.com/topic/244125-help-page-not-displaying/ Share on other sites More sharing options...
MasterACE14 Posted August 7, 2011 Share Posted August 7, 2011 missing the first curly brace with this 'if' statement: <?php if ($username) { Also the closing php tag after it: ?> Quote Link to comment https://forums.phpfreaks.com/topic/244125-help-page-not-displaying/#findComment-1253714 Share on other sites More sharing options...
ecabrera Posted August 7, 2011 Author Share Posted August 7, 2011 still wont work the page wont load up Quote Link to comment https://forums.phpfreaks.com/topic/244125-help-page-not-displaying/#findComment-1253717 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 7, 2011 Share Posted August 7, 2011 can you post your scripts/function.php & scripts/status.php? there might problems with the codes there. Quote Link to comment https://forums.phpfreaks.com/topic/244125-help-page-not-displaying/#findComment-1253720 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 7, 2011 Share Posted August 7, 2011 try this, you have alot of syntax errors in your codes. <?php ini_set( 'display_errors', 1 ); error_reporting( -1 ); date_default_timezone_set('America/Los_Angeles'); session_start(); $username = $_SESSION['username']; $userid = $_SESSION['userid']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php echo $title;?></title> <link href='styles/main.css' rel='stylesheet' type='text/css'></link> <script language="javascript" src="scripts/javascript.js"></script> <?php require("scripts/functions.php"); ?> <style type='text/css'> <!-- body{ background-color: Purple; } --> </style> </head> <body> <div id='wrapper'> <div id='header'> <div id='status'><?php require('scripts/status.php'); ?></div> <a href='<?php echo $site; ?>'><img src='images/logo.png'></img></a> </div> <?php if ($username) { ?> //login in user see this <div id='nav'> <a href='<?php echo $site;?>/videos'>Videos</a> <a href='<?php echo $site;?>/videos'>Videos</a> <a href='<?php echo $site;?>/movies'>Movies</a> </div> <?php } else { ?> //not login memebr see this <div id='nav'> <a href='<?php echo $site;?>/videos'>Videos</a> <a href='<?php echo $site;?>/movies'>Movies</a> </div><?php } ?> <div id='content'> i have correct all of them. see if they work. Quote Link to comment https://forums.phpfreaks.com/topic/244125-help-page-not-displaying/#findComment-1253721 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 7, 2011 Share Posted August 7, 2011 and i really wonder where is title gonna come from as it is not set at before its being called out. Quote Link to comment https://forums.phpfreaks.com/topic/244125-help-page-not-displaying/#findComment-1253722 Share on other sites More sharing options...
ecabrera Posted August 7, 2011 Author Share Posted August 7, 2011 your my hero how did you get that to work Quote Link to comment https://forums.phpfreaks.com/topic/244125-help-page-not-displaying/#findComment-1253724 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 7, 2011 Share Posted August 7, 2011 err, i fixed some syntax errors and add correct php tags. <title><?php echo "$title";?></title> if you are echoing a variable, you wouldn't need to have the "" for the echo. <a href='<?php echo $site?>'><img src='images/logo.png'></img></a> you echo $site without close the echo with ; <?php if ($username) // need to add { and close php ?> <div id='nav'> <a href='<?php echo $site;?>/videos'>Videos</a> <a href='<?php echo $site;?>/videos'>Videos</a> <a href='<?php echo $site;?>/movies'>Movies</a> </div> //open php again with <?php } else { //close it here ?> <div id='nav'> <a href='<?php echo $site;?>/videos'>Videos</a> <a href='<?php echo $site;?>/movies'>Movies</a> </div> //open php again with <?php } ?> <div id='content'> Quote Link to comment https://forums.phpfreaks.com/topic/244125-help-page-not-displaying/#findComment-1253726 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 7, 2011 Share Posted August 7, 2011 anyway please mark topic as solved Quote Link to comment https://forums.phpfreaks.com/topic/244125-help-page-not-displaying/#findComment-1253727 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.