PHP problem with "unsdefined variables"

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Fri May 03, 2002 9:37 pm    Post subject: PHP problem with "unsdefined variables" Reply with quote

i have a simple form that method=post with a text field called "user" na danother called "pass". i took this example from a PHP book and it has worked but on this server it doesnt. my page looks like this:

"<?
print("$user");
print("$pass");
?>

and i get

Notice: undefined variable: user in C:\abyss\htdocs\test.php on line 2
Notice: undefined variable: pass in C:\abyss\htdocs\test.php on line 3

i may have made a couple of syntax errors here but the originall is just like in the book so i dont get it! i think it might be the server so thats why im posting
thznx for any help :D
-the whackaxe
Back to top
TheLinker
-


Joined: 05 Apr 2002
Posts: 165
Location: Oslo, Norway

PostPosted: Fri May 03, 2002 9:41 pm    Post subject: Re: PHP problem with "unsdefined variables" Reply with quote

Anonymous wrote:
i have a simple form that method=post with a text field called "user" na danother called "pass". i took this example from a PHP book and it has worked but on this server it doesnt. my page looks like this:

"<?
print("$user");
print("$pass");
?>

and i get

Notice: undefined variable: user in C:\abyss\htdocs\test.php on line 2
Notice: undefined variable: pass in C:\abyss\htdocs\test.php on line 3

i may have made a couple of syntax errors here but the originall is just like in the book so i dont get it! i think it might be the server so thats why im posting
thznx for any help :D
-the whackaxe


What version of PHP are you using ??
Back to top View user's profile Send private message Visit poster's website
TheLinker
-


Joined: 05 Apr 2002
Posts: 165
Location: Oslo, Norway

PostPosted: Fri May 03, 2002 9:47 pm    Post subject: Re: PHP problem with "unsdefined variables" Reply with quote

If you are using PHP v4.2, there has been some changes in how to use "external variables"... Read http://www.php.net/release_4_2_0.php for more information.

try this:
Code:

<?php

echo $_POST["user"];
echo $_POST["pass"];

?>
Back to top View user's profile Send private message Visit poster's website
Guest






PostPosted: Sat May 04, 2002 9:57 am    Post subject: thanks Reply with quote

looks like i'm gonna have to get myself a newbool if all this isnt working anymore :p

thanks fer the help
Back to top
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Sat May 04, 2002 11:44 pm    Post subject: Re: PHP problem with "unsdefined variables" Reply with quote

TheLinker wrote:
If you are using PHP v4.2, there has been some changes in how to use "external variables"... Read http://www.php.net/release_4_2_0.php for more information.

try this:
Code:

<?php

echo $_POST["user"];
echo $_POST["pass"];

?>

Another solution: If you have PHP scripts written using the old fashion and do not have time to convert them, edit your php.ini file, locate the line
Code:

register_globals = Off

and change it to
Code:

register_globals = On

_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
AlexBGD
-


Joined: 30 May 2002
Posts: 1

PostPosted: Thu May 30, 2002 1:52 am    Post subject: Re: PHP problem with "unsdefined variables" Reply with quote

I have the same problem, and I tried register_globals=On and it still won't work. I am using PHP 4.2 I don't know much about PHP but I tried display_errors=Off in php.ini and it works fine now.
Back to top View user's profile Send private message
E-Oreo
-


Joined: 18 Apr 2002
Posts: 17

PostPosted: Wed Jun 05, 2002 10:57 pm    Post subject: but Reply with quote

but all that did was turn the error display off, that means the errors are still there it just dosn't show them, it didn't work for me either.
Back to top View user's profile Send private message Send e-mail Visit poster's website
bullseye
Guest





PostPosted: Sun Jun 09, 2002 6:27 pm    Post subject: another problem with undefined variable Reply with quote

After installing PHP 4.02 on abyss I had some problems but with your help I managed to resolve them..
Noe, after a while, with the php.ini file in windows directory I get almost in every php script file the following message:


Quote:
Error undefined variable
Quote:
var_name
in ...

(and so for every variable in the php file)
and when I delete the php.ini in windows dir. (although I shouldn't) [b]the server interprets the php but the actions (ex: execute a command in php to go to another php page) doesn't work
:x .
Also the php is interpreted by the server but only in some cases.
Please help with this matter :)

national.is.edu.ro webmaster
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group