Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Help getting variables to work

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Help getting variables to work

Postby QCumbA » Tue Feb 11, 2003 3:59 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.
QCumbA
New php-forum User
New php-forum User
 
Posts: 3
Joined: Tue Feb 11, 2003 3:45 am

Postby pootergeist » Tue Feb 11, 2003 4:29 am

recent versions of php have defaulted to register_globals = off in the php.ini
this means you should address URL passed variables from the global $_GET array

eg

echo 'Welcome to my website, '. $_GET['name'] .'!<br />';

unfortunately old books can never quite teach a language that is growing every day - am sure you'll get the hang of things tho.,
pootergeist
New php-forum User
New php-forum User
 
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK

Postby QCumbA » Tue Feb 11, 2003 4:35 am

You beauty !!!!

I want to have your children.........well.......not really, but you get the idea of how much this was winding me up

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


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 4 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.