Variable passing

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

Post Reply
davo666666666
Forum Newbie
Posts: 7
Joined: Sun Apr 15, 2007 4:56 pm

Variable passing

Post by davo666666666 »

ok, i just want to do this with my apache2 webserver on debian linux, and php, html creator dreamweaver MX

http://forums.devnetwork.net/posting.php?mode=newtopic&f=1

when i make a page with this link in it:

<A HREF="welcome.php?name=davo"> Hi, I'm davo! </A>

to a php page with this link in it:

<?php echo( "Welcome to our Web site, $name!" );?>

i get:

welcome to our web site, !


what is it a problem with???

thanks in advance, davo
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

You're assuming register_globals is turned on php.ini... don't. Use $_GET["name"] in place of $name. If this were coming from a form with method="post" you'd use $_POST["name"]. You get the idea ;)
davo666666666
Forum Newbie
Posts: 7
Joined: Sun Apr 15, 2007 4:56 pm

Post by davo666666666 »

what??

i get this parse error

Parse error: parse error, unexpected '\"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/apache2-default/welcome.php on line 9


or you could check it out at

http://yeww.dyndns.org/apache2-default/ ... ?name=Davo

the web site is HEAVILY under dev, you'll see, im just testing all my php :)
davo666666666
Forum Newbie
Posts: 7
Joined: Sun Apr 15, 2007 4:56 pm

Post by davo666666666 »

should register_globals be turned on, sounds like a security risk??
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

The security risk has to do with PHP allowing reference to a variable without explicit declaration -- leave it turned off. If you're still having problems with the code you're using, post it here.
davo666666666
Forum Newbie
Posts: 7
Joined: Sun Apr 15, 2007 4:56 pm

Post by davo666666666 »

this is the link i have coded

<A HREF="welcome.php?name=davo"> Hi, I'm davo! </A>

and this it the page

with your php script - im using dreamweaver MX is that the problem...

<?php echo( "Welcome to our Web site, $_GET["name"] !" );?>
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

Code: Select all

<?php echo  "Welcome to our Web site, ". $_GET['name'] ."!" ; ?>
davo666666666
Forum Newbie
Posts: 7
Joined: Sun Apr 15, 2007 4:56 pm

Post by davo666666666 »

yes, thanks that worked a treat

thaks
Post Reply