Jump to content


This topic is now archived and is closed to further replies.


echo problem? :(

Recommended Posts

uhm... I don't know how to explain this, but I'll post my code and sample url and see if anyone can help me get the content in to the content div.

$page = $_GET['page'];

if (isset($page)) {
include ("$page.php");
} else {
include ("home.php");

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<title>Uniquely Yours - Log Furniture</title>
<link href="misc/stylesheet.css" rel="stylesheet" type="text/css" title="default" />

<div id="base">
<div id="top"><img src="top.jpg" /></div>
<div id="navhold">
<div id="navigation">

echo '<ul id="navlist">
<li'.(($page == 'home' || empty($page)) ? ' class="active"' : '').'><a href="index.php">Home</a></li>
<li'.(($page == 'about') ? ' class="active"' : '').'><a href="index.php?page=about">About</a></li>
<li'.(($page == 'gallery') ? ' class="active"' : '').'><a href="index.php?page=gallery">Gallery</a></li>
<li'.(($page == 'contact') ? ' class="active"' : '').'><a href="index.php?page=contact">Contact</a></li>

<div id="contentholder">
<div id="content">
echo "$content";

<div id="footer">
<div id="copyright">Copyright &#169; 2006, Uniquely Yours. <br />All rights reserved.</div>
<div id="spacer"></div>



content should go in to a white box under the nav. it is showing up at top of page?

Share this post

Link to post
Share on other sites
What is the name of the file you posted the code for?

What is inside home.php?

Share this post

Link to post
Share on other sites
If that is the only thing in home.php, you need to enclose it between <?php and ?>

Look at the top of index.php.  With the URL you gave, there is no $_GET param, so it includes home.php.  home.php is just opened and dumped in place.  If you want to put php into an included file, you still need to start your php with <?php and end it with ?>

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.