Help getting variables to work

General discussions related to php

Moderators: macek, egami, gesf

QCumbA
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Feb 11, 2003 3:45 am

Help getting variables to work

Postby QCumbA » Tue Feb 11, 2003 3:51 am

Hi all im new to the forums and im new to php.

I have purchased a book which gives me a script for 2 files.

welcome.html and welcome.php

The contents of welcome.html is:

<a href="welcome.php?name=kevin"> Hi, I'm Kevin! </a>


and the file welcome.php is:

<?php
echo( "welcome to my website, $name!" );
?>


When i go to view welcome.html and click the link the page gives me the error

Notice: Undefined variable: name in C:\Inetpub\wwwroot\webboard\welcome.php on line 7
Welcome to our Web site, !


I know php is working as i have run another demo in the book, and i also have phpbb running under the same directory.

Im running Windows 2000 with IIS, fully loaded php.

Any help would be appreciated as to what the possible problem could be

Thank you for any help offered.

TheIceman5
New php-forum User
New php-forum User
Posts: 28
Joined: Tue Jan 21, 2003 9:31 pm
Contact:

Postby TheIceman5 » Tue Feb 11, 2003 5:36 am

change
<?php
echo( "welcome to my website, $name!" );
?>

to

<?php
echo( "welcome to my website, ".$_REQUEST["name"]."" );
?>


its register_globals problem you have, you need to turn it on. Go into your windows dir and open up php.ini and fin the line
register_globals = Off

and make it read

register_globals = On

and save it.
Its more of a challenge to leave it off, forces you to do the right things or you get errors

*JaH*
New php-forum User
New php-forum User
Posts: 80
Joined: Fri Jan 31, 2003 4:18 pm

Postby *JaH* » Fri Feb 14, 2003 4:13 pm

TheIceman5 wrote:Its more of a challenge to leave it off, forces you to do the right things or you get errors


and not only that, it's also a big security risk if you leave it on :D


Return to “PHP General”

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron