Connecting Tech Pros Worldwide Help | Site Map

Problem reading the variables from HTML form using PHP

Manav Sharma
Guest
 
Posts: n/a
#1: Jul 17 '05
Hello friends.
I am using PHP(standalone program and not as Apache module) with Apache Server.
My Problem is that i am not able to read the HTML form's variable..


Form' Code Snippet
==================
<B>Name:</B>
<INPUT TYPE="text" SIZE="40" NAME=name>
<BR>


PHP Script's code snippet
==========================
<?php
echo ($name);
?>
Marian Heddesheimer
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Problem reading the variables from HTML form using PHP


On 6 Jun 2004 01:11:16 -0700, themanavsharma@hotmail.com (Manav
Sharma) wrote:
[color=blue]
>PHP Script's code snippet
>==========================
> <?php
> echo ($name);
> ?>[/color]

try echo $_POST['name'];

Regards

Marian


--
Internet-Dienstleistungen - von der Webseite bis zum Online-Shop
http://www.heddesheimer.de mailto:marian@heddesheimer.de
Manav Sharma
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Problem reading the variables from HTML form using PHP


> echo $_POST['name'];[color=blue]
>
> the above code isnt working either...[/color]

the problem is one sided. PHP script can send date and time stuff to
the client but ...


it is not able to read <FORM> data coming from the client..
Alvaro G Vicario
Guest
 
Posts: n/a
#4: Jul 17 '05

re: Problem reading the variables from HTML form using PHP


*** Manav Sharma wrote/escribió (7 Jun 2004 08:28:21 -0700):[color=blue][color=green]
>> echo $_POST['name'];
>>
>> the above code isnt working either...[/color]
>
> the problem is one sided. PHP script can send date and time stuff to
> the client but ...
>
>
> it is not able to read <FORM> data coming from the client..[/color]

Then try:

echo $_GET['name'];

--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Manav Sharma
Guest
 
Posts: n/a
#5: Jul 17 '05

re: Problem reading the variables from HTML form using PHP


HELLO FRIENDS.....
THE PROBLEM HAS BEEN SORTED OUT.

THERE WAS THIS TYPICAL CONFIGURATION PROBLEM WITH PHP..... I HAVE
FIXED IT AND NOW IT IS WORKING PERFECTLY! THANKS FOR YOUR HELP... THE
COMMUNITY FEELING IS AMAZING :)..... BELOW IS THE PROBLEM WHICH I
FIXED......

================================================== ================

There is a word called 'register_globals' in the php.ini file.
By default this word has been assigned a value of 'off'
ie. register_globals= off

Change the above line to 'register_globals = on' and save the file.
Alvaro G Vicario
Guest
 
Posts: n/a
#6: Jul 17 '05

re: Problem reading the variables from HTML form using PHP


*** Manav Sharma wrote/escribió (8 Jun 2004 07:42:30 -0700):[color=blue]
> Change the above line to 'register_globals = on' and save the file.[/color]

Bad idea. There is a reason why register_globals is set to off by default.
You'd better fix you scripts instead so they don't depend on running in an
insecure server. Use $_GET, $_POST and $_SESSION.


--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Brad Kent
Guest
 
Posts: n/a
#7: Jul 17 '05

re: Problem reading the variables from HTML form using PHP


ugh... It's off by default for a reason.
you should explicitly use the $_GET and $_POST arrays

themanavsharma@hotmail.com (Manav Sharma) wrote in message news:<1e2c8fef.0406080642.30573f0f@posting.google. com>...[color=blue]
> HELLO FRIENDS.....
> THE PROBLEM HAS BEEN SORTED OUT.
>
> THERE WAS THIS TYPICAL CONFIGURATION PROBLEM WITH PHP..... I HAVE
> FIXED IT AND NOW IT IS WORKING PERFECTLY! THANKS FOR YOUR HELP... THE
> COMMUNITY FEELING IS AMAZING :)..... BELOW IS THE PROBLEM WHICH I
> FIXED......
>
> ================================================== ================
>
> There is a word called 'register_globals' in the php.ini file.
> By default this word has been assigned a value of 'off'
> ie. register_globals= off
>
> Change the above line to 'register_globals = on' and save the file.[/color]
Manav Sharma
Guest
 
Posts: n/a
#8: Jul 17 '05

re: Problem reading the variables from HTML form using PHP


Thanks Mr. Brad for the advice.
Now i understand , why the register_globals is set to off by default.
But there is a terrible problem here. For beginners, all these
contraints does not matter in the initial stage of the learning curve
and thus only because of this, novice users cant even take few steps
in the direction of learning. So i think , this feature can be turned
on for the time being.

Details can follow :) But thanks a lot for your advice. Take Care :)
Regards... Manav
Closed Thread