View previous topic :: View next topic |
Author |
Message |
zwt -
Joined: 15 Jul 2002 Posts: 1
|
Posted: Mon Jul 15, 2002 1:57 pm Post subject: unknown variable error |
|
|
I came to the forums to check what was up when nothing I modified on the page worked. I read up on some of the posts and tried turning "register_globals" On in my php.ini file, but nothing changed. My only line of php code is:
Code: | <?php if ($id == "") { include "home.php"; } else { include "$id.php"; } ?> |
and it worked fine on a free webhost i used to have (from wut ive read, it seems to be cuz of the latest php release)
neways, im a complete php newbie and dont understand any of the other stuff which was mention, so can sum1 please explain how to get that single line of code working one way or the other? :) |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon Jul 15, 2002 2:59 pm Post subject: Re: unknown variable error |
|
|
zwt wrote: | I came to the forums to check what was up when nothing I modified on the page worked. I read up on some of the posts and tried turning "register_globals" On in my php.ini file, but nothing changed. My only line of php code is:
Code: | <?php if ($id == "") { include "home.php"; } else { include "$id.php"; } ?> |
and it worked fine on a free webhost i used to have (from wut ive read, it seems to be cuz of the latest php release)
neways, im a complete php newbie and dont understand any of the other stuff which was mention, so can sum1 please explain how to get that single line of code working one way or the other? :) |
This behaviour is caused by the new release of PHP which do not automatically register GET and POST variables as global.
Anyway, instead of using $id use $_GET['id'] or $_POST['id'] (depending on the method of the request). _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
ruiner333 Guest
|
Posted: Sun Dec 22, 2002 11:36 am Post subject: |
|
|
Include this in the beginning of your program to register form vars as global.
Code: | import_request_variables("gpc","form_"); |
First parameter is what data to register globally.
g = get
p = post
c = cookie
Second parameter is an optional prefix to add to the variable name. |
|
Back to top |
|
|
!Keys -
Joined: 23 Nov 2002 Posts: 156 Location: Holland, Enschede
|
Posted: Sun Dec 22, 2002 2:15 pm Post subject: |
|
|
Aprelium is 100% right 8)
i don´t really undersand what you mean, ruiner 8O _________________ !Keys || MwM^computerware |
|
Back to top |
|
|
gary Guest
|
Posted: Mon Jan 13, 2003 1:30 am Post subject: i add the code on my php.ini then nouse |
|
|
ruiner333 wrote: | Include this in the beginning of your program to register form vars as global.
Code: | import_request_variables("gpc","form_"); |
First parameter is what data to register globally.
g = get
p = post
c = cookie
Second parameter is an optional prefix to add to the variable name. |
wut happen no respond but no err occurred so wut the use? |
|
Back to top |
|
|
|