Problem reading the variables from HTML form using PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Manav Sharma

    #1

    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);
    ?>
  • Marian Heddesheimer

    #2
    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-Dienstleistunge n - von der Webseite bis zum Online-Shop
    http://www.heddesheimer.de mailto:marian@h eddesheimer.de

    Comment

    • Manav Sharma

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

      Comment

      • Alvaro G Vicario

        #4
        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
        --

        Comment

        • Manav Sharma

          #5
          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_globa ls' in the php.ini file.
          By default this word has been assigned a value of 'off'
          ie. register_global s= off

          Change the above line to 'register_globa ls = on' and save the file.

          Comment

          • Alvaro G Vicario

            #6
            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_globa ls = on' and save the file.[/color]

            Bad idea. There is a reason why register_global s 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
            --

            Comment

            • Brad Kent

              #7
              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.3057 3f0f@posting.go ogle.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_globa ls' in the php.ini file.
              > By default this word has been assigned a value of 'off'
              > ie. register_global s= off
              >
              > Change the above line to 'register_globa ls = on' and save the file.[/color]

              Comment

              • Manav Sharma

                #8
                Re: Problem reading the variables from HTML form using PHP

                Thanks Mr. Brad for the advice.
                Now i understand , why the register_global s 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

                Comment

                Working...