The Hick Man
23 Feb 2006, 12:57 PM
Hi there,
I don't suppose anyone could help me with this little but really annoying problem...
I have a menu working at the top of the page so that when u click a link it turns an active color (pink) and the rest are blue...
it then displays content depending on what is clicked using php...
so basically all my code is run from one page.
When I first did this this the content changed in the middle of the screen without refreshing the page but since I have added more and nore code into the content (Tables, javascript code, spaces etc) it now refreshes... the screen flases which I don't want if I can help...
It works with a basic code like this as follows but when I start filling up the case statement content it flashes/refreshes the page when a link is clicked...
<?php
function getCSS($x) {
if ($x == $_GET["Section"]) {
echo "activeButton";
} else {
echo "button";
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Page</title>
<style type="text/css" media="screen"><!--
.button {
color: #993399;
text-decoration: none;
}
--></style>
</head>
<body bgcolor="#ffffff">
<a class="<?php getCSS("")?>" href="untitled.php">Home</a> <a class="<?php getCSS("News")?>" href="untitled.php?Section=News">News</a> <a class="<?php getCSS("Products")?>" href="untitled.php?Section=Products">Products</a>
<?php
switch ($_GET["Section"]) {
case "News":
echo "<h2>News</h2>
<p><a href='index.php'>Article 1</a></p>
<p><a href='index.php?Section=News'>Article 2</a></p>";
EG WHEN MORE CODE ADDED HERE
break;
case "Products":
echo "<h2>Products</h2>
<p>Here are our products</p>";
break;
default:
echo "<h2>Welcome!</h2>
<p>Welcome to my webpage!</p>";
break;
}
?>
Any ideas to what could be causing this? - I would be extremely grateful.
Cheers
Brain.
I don't suppose anyone could help me with this little but really annoying problem...
I have a menu working at the top of the page so that when u click a link it turns an active color (pink) and the rest are blue...
it then displays content depending on what is clicked using php...
so basically all my code is run from one page.
When I first did this this the content changed in the middle of the screen without refreshing the page but since I have added more and nore code into the content (Tables, javascript code, spaces etc) it now refreshes... the screen flases which I don't want if I can help...
It works with a basic code like this as follows but when I start filling up the case statement content it flashes/refreshes the page when a link is clicked...
<?php
function getCSS($x) {
if ($x == $_GET["Section"]) {
echo "activeButton";
} else {
echo "button";
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Page</title>
<style type="text/css" media="screen"><!--
.button {
color: #993399;
text-decoration: none;
}
--></style>
</head>
<body bgcolor="#ffffff">
<a class="<?php getCSS("")?>" href="untitled.php">Home</a> <a class="<?php getCSS("News")?>" href="untitled.php?Section=News">News</a> <a class="<?php getCSS("Products")?>" href="untitled.php?Section=Products">Products</a>
<?php
switch ($_GET["Section"]) {
case "News":
echo "<h2>News</h2>
<p><a href='index.php'>Article 1</a></p>
<p><a href='index.php?Section=News'>Article 2</a></p>";
EG WHEN MORE CODE ADDED HERE
break;
case "Products":
echo "<h2>Products</h2>
<p>Here are our products</p>";
break;
default:
echo "<h2>Welcome!</h2>
<p>Welcome to my webpage!</p>";
break;
}
?>
Any ideas to what could be causing this? - I would be extremely grateful.
Cheers
Brain.