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
o51974
Forum Newbie
Posts: 9 Joined: Tue May 06, 2003 10:55 am
Post
by o51974 » Tue May 06, 2003 10:55 am
hi all,
I have set up a link as follows:
Code: Select all
//setup.html
<a href=xyz.php?id=123>download</a>
When user click this link, I have
Code: Select all
<?php
//xyz.php
$id=$_GETї'id'];
echo $id;
echo "<br>";
$id2=$HTTP_GET_VARSї'id'];
echo $id2;
?>
For some reason, both of them are not echoed. I checked the php.ini and the register_globals=On. The PHP ver is 4.0.6. I'd appreciate any idea.
Beans
Forum Commoner
Posts: 49 Joined: Mon Dec 23, 2002 3:06 am
Location: Manila, Philippines
Contact:
Post
by Beans » Tue May 06, 2003 11:14 am
maybe you could try:
//setup.html
<a href="xyz.php?id=123">download</a>
daven
Forum Contributor
Posts: 332 Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:
Post
by daven » Tue May 06, 2003 11:23 am
Beans is correct. You need quotes around your href info.
If you still do not get any results, try print_r($_REQUEST) and print_r($_SERVER['QUERY_STRING']) to see if you are getting anything passed.
Beans
Forum Commoner
Posts: 49 Joined: Mon Dec 23, 2002 3:06 am
Location: Manila, Philippines
Contact:
Post
by Beans » Tue May 06, 2003 11:32 am
daven,
$_REQUEST might not work for him since he's on PHP 4.0.6
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Tue May 06, 2003 12:14 pm
$_GET['id'] definitely won't work as it is only available for PHP version 4.1 or higher.
Check the output of:
Code: Select all
echo '<pre>';
print_r($HTTP_GET_VARS);
echo '</pre>';
to see what is getting passed - also make sure that you can see the query string in the URL in the Address bar of your browser.
Mac
o51974
Forum Newbie
Posts: 9 Joined: Tue May 06, 2003 10:55 am
Post
by o51974 » Tue May 06, 2003 12:18 pm
I do have the quote but I just forgot to put in. Sorry about the confustion.
At 4.0.6, do I have to use $HTTP_*_VARS instead of $_POST? Is there a way for me to activate the shorter alias?
Thank you for all the reply.
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Tue May 06, 2003 12:30 pm
o51974 wrote: At 4.0.6, do I have to use $HTTP_*_VARS instead of $_POST?
Yes
o51974 wrote: Is there a way for me to activate the shorter alias?
Not to have them automatically assigned, no (well not unless you upgraded your PHP version). You could do things like:
at the top of your scripts but the $_POST array in this case will just be a copy of $HTTP_POST_VARS and will not have the special (autoglobal) properties of $_POST in PHP 4.1 and up.
Mac
o51974
Forum Newbie
Posts: 9 Joined: Tue May 06, 2003 10:55 am
Post
by o51974 » Tue May 06, 2003 2:11 pm
I get it. Thank you for all the help.