p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: PHP Newbie Question


Message #1 by "Guitargod \(E-mail\)" <kaykay@g...> on Sat, 18 May 2002 11:12:55 +0530
PHP Newbie question - FORM Methods

Hey there,
I know that I'm probably doing something real stupid.. but it's been a long
day and my brains are fried...
here goes...
I decided to check out PHP today... so after a few wrangles I installed it
(4.1.1) on my Win2k machine : (running IIS 5).. everything seemed to have
been installed fine... phpinfo() displayed fine... so I thought that
everything was cool. Tested out a few echo statements... were fine... so IIS
and PHP were being good buddies about the whole thing...
I then tried to test out a form typothing...
so this was my example:

----------
test1.html
----------
<HTML
<HEAD></HEAD>
<BODY>
<FORM METHOD=GET ACTION="test2.php">
Type something dude
<INPUT NAME="info" TYPE="TEXT">
<INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>

----------
test2.php
----------

<HTML
<HEAD> </HEAD>
<BODY>
Info 
<?php
echo $info;
?>
</BODY>
</HTML>

--------------

When I click on the submit query thinggy (in test1.html)... test2.php comes
up fine, but only displays

info

even though the address bar says:
http://127.0.0.1/test2.php?info=whoa


I first thought that it would be something with the case sensitivity...
but apparently not.. I have since tried using
$_REQUEST["info"],$_GET["info"]... set register_globals to off etc etc

The very fact that PHP seems to work (otherwise) suggests that it has been
installed properly and that IIS is doing it's job... so I guess that either
I'm doing something stupid.. or PHP has not been configured properly...

My brain is dead...
pls help
-KayKay

Message #2 by "Jason DeWitt" <roxet@c...> on Sat, 18 May 2002 10:47:29 -0500
If Register Globals is off you are going to need to use $_REQUEST["info"]
and that should work for you. =)


----- Original Message -----
From: "Guitargod (E-mail)" <kaykay@g...>
To: "beginning php" <beginning_php@p...>
Sent: Saturday, May 18, 2002 12:42 AM
Subject: [beginning_php] PHP Newbie Question


> PHP Newbie question - FORM Methods
>
> Hey there,
> I know that I'm probably doing something real stupid.. but it's been a
long
> day and my brains are fried...
> here goes...
> I decided to check out PHP today... so after a few wrangles I installed it
> (4.1.1) on my Win2k machine : (running IIS 5).. everything seemed to have
> been installed fine... phpinfo() displayed fine... so I thought that
> everything was cool. Tested out a few echo statements... were fine... so
IIS
> and PHP were being good buddies about the whole thing...
> I then tried to test out a form typothing...
> so this was my example:
>
> ----------
> test1.html
> ----------
> <HTML
> <HEAD></HEAD>
> <BODY>
> <FORM METHOD=GET ACTION="test2.php">
> Type something dude
> <INPUT NAME="info" TYPE="TEXT">
> <INPUT TYPE=SUBMIT>
> </FORM>
> </BODY>
> </HTML>
>
> ----------
> test2.php
> ----------
>
> <HTML
> <HEAD> </HEAD>
> <BODY>
> Info 
> <?php
> echo $info;
> ?>
> </BODY>
> </HTML>
>
> --------------
>
> When I click on the submit query thinggy (in test1.html)... test2.php
comes
> up fine, but only displays
>
> info
>
> even though the address bar says:
> http://127.0.0.1/test2.php?info=whoa
>
>
> I first thought that it would be something with the case sensitivity...
> but apparently not.. I have since tried using
> $_REQUEST["info"],$_GET["info"]... set register_globals to off etc etc
>
> The very fact that PHP seems to work (otherwise) suggests that it has been
> installed properly and that IIS is doing it's job... so I guess that
either
> I'm doing something stupid.. or PHP has not been configured properly...
>
> My brain is dead...
> pls help
> -KayKay
>
>
>

Message #3 by "Guitargod \(E-mail\)" <kaykay@g...> on Sat, 18 May 2002 22:24:20 +0530
sorry mate... that should have beed register Globals ... ON
sorry again
:(
-K

-----Original Message-----
From: Jason DeWitt [mailto:roxet@c...]
Sent: 18 May 2002 21:17
To: beginning php
Subject: [beginning_php] Re: PHP Newbie Question


If Register Globals is off you are going to need to use $_REQUEST["info"]
and that should work for you. =)


----- Original Message -----
From: "Guitargod (E-mail)" <kaykay@g...>
To: "beginning php" <beginning_php@p...>
Sent: Saturday, May 18, 2002 12:42 AM
Subject: [beginning_php] PHP Newbie Question


> PHP Newbie question - FORM Methods
>
> Hey there,
> I know that I'm probably doing something real stupid.. but it's been a
long
> day and my brains are fried...
> here goes...
> I decided to check out PHP today... so after a few wrangles I installed it
> (4.1.1) on my Win2k machine : (running IIS 5).. everything seemed to have
> been installed fine... phpinfo() displayed fine... so I thought that
> everything was cool. Tested out a few echo statements... were fine... so
IIS
> and PHP were being good buddies about the whole thing...
> I then tried to test out a form typothing...
> so this was my example:
>
> ----------
> test1.html
> ----------
> <HTML
> <HEAD></HEAD>
> <BODY>
> <FORM METHOD=GET ACTION="test2.php">
> Type something dude
> <INPUT NAME="info" TYPE="TEXT">
> <INPUT TYPE=SUBMIT>
> </FORM>
> </BODY>
> </HTML>
>
> ----------
> test2.php
> ----------
>
> <HTML
> <HEAD> </HEAD>
> <BODY>
> Info 
> <?php
> echo $info;
> ?>
> </BODY>
> </HTML>
>
> --------------
>
> When I click on the submit query thinggy (in test1.html)... test2.php
comes
> up fine, but only displays
>
> info
>
> even though the address bar says:
> http://127.0.0.1/test2.php?info=whoa
>
>
> I first thought that it would be something with the case sensitivity...
> but apparently not.. I have since tried using
> $_REQUEST["info"],$_GET["info"]... set register_globals to off etc etc
>
> The very fact that PHP seems to work (otherwise) suggests that it has been
> installed properly and that IIS is doing it's job... so I guess that
either
> I'm doing something stupid.. or PHP has not been configured properly...
>
> My brain is dead...
> pls help
> -KayKay
>
>
>



Message #4 by "Nikolai Devereaux" <yomama@u...> on Sat, 18 May 2002 18:47:32 -0700
Hmm...

> echo $info;

> I first thought that it would be something with the case sensitivity...
> but apparently not.. I have since tried using
> $_REQUEST["info"],$_GET["info"]... set register_globals to off etc etc




>
> The very fact that PHP seems to work (otherwise) suggests that it has been
> installed properly and that IIS is doing it's job... so I guess
> that either
> I'm doing something stupid.. or PHP has not been configured properly...
>
> My brain is dead...
> pls help
> -KayKay
>
>

Message #5 by "Nikolai Devereaux" <yomama@u...> on Sat, 18 May 2002 18:51:41 -0700
OOPS!  Sent it to early.  One of those days again.


Hmm...

> echo $info;

> I first thought that it would be something with the case sensitivity...
> but apparently not.. I have since tried using
> $_REQUEST["info"],$_GET["info"]... set register_globals to off etc etc

Whatever register_globals is set to should have no effect on whether or not
$_GET['info'] works or not.

It should just always work.

Try using print_r() to output the contents of your globals arrays.

test.php
----
<HTML>
<HEAD></HEAD>
<BODY>
<FORM METHOD=GET ACTION="test.php">
Type something dude
<INPUT NAME="info" TYPE="TEXT">
<INPUT TYPE=SUBMIT>
</FORM>

<HR>
<PRE>
<?php
  print_r($_GET);
?>
</PRE>
</BODY>
</HTML>


Nik

Message #6 by <KayKay@g...> on Tue, 21 May 2002 01:58:22 +0530
hey there dudes and dudettes,
    I tried everything... gave up.. upgraded to 4.2.1 (was using 4.1.1
prev). Nothing happened - again modified  Register_globals to On, and things
are working now finally...
YAY!
-KayKay
-----Original Message-----
From: Nikolai Devereaux [mailto:yomama@u...]
Sent: 19 May 2002 07:18
To: beginning php
Subject: [beginning_php] RE: PHP Newbie Question



Hmm...

Message #7 by "Dan Ostrowski" <dan@t...> on Tue, 21 May 2002 22:13:02
This is great if you are using your own server, or personal server, but 
(and i only mention this because you said you are a n00bie like me) 
remember that eventually "Register Globals" will be turned off by default 
on PHP builds.  Most Admins will probably leave them that way for 
increased security.

I would make sure you are familiar with all the environmental variables, 
especially the $_GET and $_POST vars.  To get in the habit of using these 
will be a head start.

regards,

dan

  Return to Index