Page 1 of 1

problem pulling the variable form a query string

Posted: Mon Oct 23, 2006 7:54 am
by tdock
JayBird | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I am having a problem pulling the variable from a query string

For example with this url: 

http://www.abc.com/go.php?id=2

I would like to pull the id value from the query string and use it for my $id variable within the go.php page. For simplification I tried this:

Code: Select all

<html>

<?php

$id = $_get['id'];

echo $id

</html>
I don’t understand why this doesn’t work. I would expect for the number 2 to display but I get nothing. I am new to php and any advice would be greatly appreciated.


JayBird | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Mon Oct 23, 2006 8:14 am
by JayBird

Code: Select all

<html>

<?php

$id = $_GET['id'];

echo $id;

</html>

Posted: Mon Oct 23, 2006 8:15 am
by Rovas
You forgot to put ; after
echo $id
Maybe id it' s empty or the PHP parser doesn' t parse it (it' s an unknown index for it). Open your php.ini file and at the section \Error handling and logging enable to be displayed all (error_reporting = E_ALL)

Posted: Mon Oct 23, 2006 11:44 am
by tdock
Thanks!