/    Sign up×
Community /Pin to ProfileBookmark

Screen refresh problem

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…

[code=php]
<?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;
}
?>
[/code]

Any ideas to what could be causing this? – I would be extremely grateful.

Cheers

Brain.

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@bokehFeb 23.2006 — What you are doing is bad practice. Don't just have one file, have one file for each page. Store all the common sections in one or several files for inclusion where necessary. Use the query string for its correct job, fetching data.
Copy linkTweet thisAlerts:
@The_Hick_ManauthorFeb 24.2006 — Thanks a lot for the tips Bokeh... so you're saying I should use the query to fetch the variable data from other pages??

I don't suppose you could give me a quick example of how I would do that with my code could you please?

Many Thanks

Brain
×

Success!

Help @The_Hick_Man spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...