0
<?php
if ($id == 1 && $lang == 1)
{
    echo "hello";
}
?>

hey guys i am working for my final year project. i have a problem. when i tried to run this url on my pc

http://localhost/filename?id=1&lang=1

it wouldn't work....

but when i tried this on my hosting, it will print out the word "hello".


my hosting is running php4....

and my pc is running php5...

does version matter?

4
Contributors
6
Replies
7
Views
9 Years
Discussion Span
Last Post by Eko
0

It has to do with the magic variables setting. Try using $_REQUEST and $_REQUEST instead.

0

It has to do with the magic variables setting. Try using $_REQUEST and $_REQUEST instead.

Thank you for replying.... really appreciate it...

i tried....

<?php
if ($_REQUEST['$id==1'] && $_REQUEST['$lang==1'])
{
    echo "hello";
}
?>

but its still not working...

how do i turn on the magic variables settings?

0

no,no...

[LIST=1]
[*]<?php
[*]if ($_REQUEST['id'] == 1 && $_REQUEST['lang'] == 1)
[*]{
[*]    echo "hello";
[*]}
[*]?>
[/LIST]
0

azimuth0... :)

Thank you very much..... its working now...

i just found out if u turn on the "register global" setting for php5 ... the old codes will work as well....

again.... thanks.... really appreciate your help...

0
<?php

if ($_GET['id'] == 1 && $_GET['lang'] == 1)
{
    echo "hello";
}
?>

- Mitko Kostov

0

azimuth0... :)

Thank you very much..... its working now...

i just found out if u turn on the "register global" setting for php5 ... the old codes will work as well....

again.... thanks.... really appreciate your help...

It's better if you leave it off . Imagine how easy is for someone to hack your code .This is the reason why the developers set the register_globals off by default from php 4.2 . Instead u can use the EGPCS values ( Enviroment , Get , Post , Cookies , Server ) it's much safer

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.