View Full Version : PHP Help Needed!!!
5vz-fe
09-04-2004, 02:39 AM
I am just playing with PHP with different webservers (IIS and Apache)
Running into one interesting probelm, I can't get html forms to pass variables into php script. Can anyone tell me if I did something wrong with the conf or ini files?
HTML:
<form method="POST" action="example18.php3">
<div align="left">
<font face="BankGothic Md BT">Admin password?</font>
<input type="password" name="pw" size="14"><input type="submit" value="Submit"></p>
</div></form>
PHP:
<?
$adminpass = "test123";
if ($pw == $adminpass)
{
print("Welcome to the administration area!");
}
else
{
print("Wrong password");
}
?>
When I run the html and submit it tells me undefined variable pw.
Anyone know why?
5vz-fe
09-04-2004, 04:18 PM
Really?? No one?
Overmind
09-04-2004, 05:26 PM
just a random guess, try:
if($_POST['pw'] == $adminpass)
if it works I can explain what is it you're doing wrong ...
5vz-fe
09-04-2004, 07:34 PM
GREAT!!!!!! IT WORKS!!!!!!!! Thanx for the big help Overmind.
What did I do wrong exactly??..I was just copying and pasting the example on the webpage. :?:
blast
09-04-2004, 08:12 PM
well you had nothing declaring where $pw was coming from in what you posted first of all ;)
5vz-fe
09-04-2004, 08:25 PM
ahhhhhh.................stupid website.....stupid me........
thx guys, always get what I needed to know here.
Overmind
09-05-2004, 06:12 PM
well you had nothing declaring where $pw was coming from in what you posted first of all ;)
well, that is the way PHP used to work by default settings... you could access http request parameters this way... very dangerous & stupid. Caused lots of tears and confusion to some "l33t hax0r PHP coders" :lol: either when their sites were being hacked or when this "feature" got disabled by default.
5vz-fe: it looks like you've been very unluky picking up the web site to learn from :|. Anyways for what you've been doing wrong read this: http://www.php.net/register_globals. Also reading through their PHP Manual (http://www.php.net/manual/en/index.php) is highly recommended (I know it's huge and long :shock:, but I'm unaware of any better source :().
Ronster101
09-06-2004, 08:27 AM
well you had nothing declaring where $pw was coming from in what you posted first of all ;)
well, that is the way PHP used to work by default settings... you could access http request parameters this way... very dangerous & stupid. Caused lots of tears and confusion to some "l33t hax0r PHP coders" :lol: either when their sites were being hacked or when this "feature" got disabled by default.
hahha well maybe, but damned if you'll see one of my servers ever running with register globals = On , even if it does mean that many of the pre coded things like commerce stores etc wont work.. just have to search harder for well coded scripts :)
5vz-fe
09-06-2004, 01:46 PM
Overmind, you are totally right, you cannot believe how much trobule that stupid webpage brought me. I keep changing the php.ini script thinking that I have set the variables wrong or something. I even wipe the Apache server clean and try the IIS server instead...and still the same results...that's y I turn to u guys. <sigh>
vBulletin® v3.8.7, Copyright ©2000-2026, vBulletin Solutions, Inc.