PDA

View Full Version : php script problems



wrigh_g
01-24-2004, 05:39 AM
Can anybody help me with this problem.
I want to display all webpages as .txt files to eliminate the use of frames. However, i have come across a problem.
I want the page to display welcome.txt as soon as the page loads, but also get a variable when a link is clicked so it goes to another .txt file.

I think it has something to do with a IF statement but i can't get to to work.

Here is my script ATM:
<?PHP
IF(@$name=$_GET('name')){
if($name=""){include("welcome.txt");
} else {
include("$name.txt");
}
} else {
echo('Unable to connect to the server');
}
?>

chromate
01-24-2004, 06:00 AM
IF(@$name=$_GET('name')){

This is probably the line that's causing the problem. You need two equal signs, and also square brackets, like so:

IF(@$name==$_GET['name']){

Otherwise, if you only use one equal sign, you're assigning the value of the $_GET['name'] to $name and it will always be true.

Though, I'm not really sure what you're trying to do. Why do you need to use .txt files to get rid of frames?

wrigh_g
01-24-2004, 06:06 AM
Thanks very much, works now.
Amazing how a little error like that can cause the whole thing to fail.

As for the frames, i dont like using frames so i use:
include("name.txt"); to display information instead of using a iframe.

Anyways, thanks again.
:)

incka
01-24-2004, 06:32 AM
Yes, Amazing

Cough*Windows*Cough

MarkB
01-24-2004, 06:54 AM
Or, you could use SSI ;)