<?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?

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

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?

no,no...

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

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...

<?php

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

- Mitko Kostov

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.