Page 1 of 1

This one line of CODE won't work

Posted: Sun May 19, 2002 10:24 pm
by Benjamin
Ok after 2 hours of being totally confused about why some code which I copied straight out of a book doesn't work, I decided maybe some of you could help me.

What I did is took this one line of code and threw it into a a file called text.php

<?php echo $author; ?>

Then I pulled up http://localhost/text.php?author=test

And walla.... A blank page EVERYTIME.

Yes I have IIS and PHP installed. Please Help this is driving me crazy. :cry:

Posted: Sun May 19, 2002 10:48 pm
by lc
how about

Code: Select all

<?php echo "$author"; ?>
try that. but it should have worked

Nope

Posted: Sun May 19, 2002 11:23 pm
by Benjamin
I tried your code above, that doesn't work either.

Posted: Sun May 19, 2002 11:31 pm
by Benjamin
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<?php echo $author; ?>
</body>
</html>

That code works on my remote server, but not on my local machine.

Posted: Sun May 19, 2002 11:50 pm
by mydimension
are you running PHP 4.2.0? 'cause if so then globals are not auto registered. you can either change the php.ini to reflect this or access the variable through $_GET['author']

Got it

Posted: Mon May 20, 2002 12:15 am
by Benjamin
Ok I got it to work, apparently I didn't copy the php.ini file into the system directory.