Problem reading the variables from HTML form using PHP

This is a discussion on Problem reading the variables from HTML form using PHP within the PHP Language forums, part of the PHP Programming Forums category; Hello friends. I am using PHP(standalone program and not as Apache module) with Apache Server. My Problem is that ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-06-2004
Manav Sharma
 
Posts: n/a
Default Problem reading the variables from HTML form using PHP

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);
?>
Reply With Quote
  #2 (permalink)  
Old 06-06-2004
Marian Heddesheimer
 
Posts: n/a
Default Re: Problem reading the variables from HTML form using PHP

On 6 Jun 2004 01:11:16 -0700, themanavsharma@hotmail.com (Manav
Sharma) wrote:

>PHP Script's code snippet
>==========================
> <?php
> echo ($name);
> ?>


try echo $_POST['name'];

Regards

Marian


--
Internet-Dienstleistungen - von der Webseite bis zum Online-Shop
http://www.heddesheimer.de mailto:marian@heddesheimer.de
Reply With Quote
  #3 (permalink)  
Old 06-07-2004
Manav Sharma
 
Posts: n/a
Default Re: Problem reading the variables from HTML form using PHP

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


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..
Reply With Quote
  #4 (permalink)  
Old 06-07-2004
Alvaro G Vicario
 
Posts: n/a
Default Re: Problem reading the variables from HTML form using PHP

*** Manav Sharma wrote/escribió (7 Jun 2004 08:28:21 -0700):
>> echo $_POST['name'];
>>
>> the above code isnt working either...

>
> 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..


Then try:

echo $_GET['name'];

--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Reply With Quote
  #5 (permalink)  
Old 06-08-2004
Manav Sharma
 
Posts: n/a
Default 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.
Reply With Quote
  #6 (permalink)  
Old 06-08-2004
Alvaro G Vicario
 
Posts: n/a
Default Re: Problem reading the variables from HTML form using PHP

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


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
--
Reply With Quote
  #7 (permalink)  
Old 06-08-2004
Brad Kent
 
Posts: n/a
Default 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>...
> 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.

Reply With Quote
  #8 (permalink)  
Old 06-10-2004
Manav Sharma
 
Posts: n/a
Default 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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:33 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0