A PHP question for lovers of it.

NEWMAN

Live GEEK Radio
At the top of my PHP page I need a to assign a value to a veriable say $url and $note.

when you get a direct hit on this page there are no velues assigned to these verables!

http://www.philipsdomain.com/the_internet/html/hyperlinks.php

at the moment i have ...

<?php

if ($url == "") {
$url="http://www.philipnz.com/";
$note="This is my Link";
}
?>

How ever i get Warning: Undefined variable: url in d:\website\the_internet\html\hyperlinks.php on line 3

What can I put in "" to get a NUL return
 

fury

Administrator
Staff member
if( $variable ) is a shorthand way of saying "If $variable exists...", so try the following code:

PHP:
if( !$url )
{
  $url = "http://www.philipnz.com/"; 
  $note = "This is my Link"; 
}
 

NEWMAN

Live GEEK Radio
Ouch .....

This code dosen't work still.

Warning: Undefined variable: url in d:\website\the_internet\html\hyperlinks.php on line 3

still saying that your

if ( !$url )

it is still looking for something to be assigned before the page is loaded. :D
 

fury

Administrator
Staff member
Well, I'm stumped already... :o

I'll be back in a couple hours... email me the page source at [email protected] and I'll look at it. Probably won't be able to make much of it since I'm not extensively versed in PHP just yet, but I'll give it a whirl
 

fury

Administrator
Staff member
When I tested the file on my web server it appeared to work fine...

:confused:
 

fury

Administrator
Staff member
My web server is using PHP 4.0.6, Apache 1.3.19 for Win32, running on an overclocked processor :smash:

Next time I catch you online I'll give you a URL to your page on my web server just so you can verify it works the way you intended it to when you coded it
 
Top