PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Themodem
Forum Newbie
Posts: 6 Joined: Mon Feb 23, 2004 8:53 am
Location: Keighley, UK
Post
by Themodem » Mon Apr 19, 2004 8:17 am
Hi all
im just messing around with php and have hit a problem
ive got some simple code
and i keep getting
Notice: Undefined variable: name error.
Can anyone help me?
i am using EasyPHP
Cheers Lee
Last edited by
Themodem on Mon Apr 19, 2004 8:53 am, edited 1 time in total.
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Mon Apr 19, 2004 8:19 am
you need to do something like this
Code: Select all
$name = "Mark"; // Define the variable
echo $name; // Use the variable
Mark
Themodem
Forum Newbie
Posts: 6 Joined: Mon Feb 23, 2004 8:53 am
Location: Keighley, UK
Post
by Themodem » Mon Apr 19, 2004 8:28 am
i should have put the reason for the code
i am using it so i can use a link like
index.php?name=Lee
The error is fixed but the name still doesnt appear
Cheers Lee
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Mon Apr 19, 2004 8:30 am
ah, if you are passing the name through the query string, you will need to do this
Code: Select all
$name = $_GET['name'];// Define the variable
echo $name; // Use the variable
Themodem
Forum Newbie
Posts: 6 Joined: Mon Feb 23, 2004 8:53 am
Location: Keighley, UK
Post
by Themodem » Mon Apr 19, 2004 8:53 am
Works like a charm thanks