Referencing PHP_SELF variable within HTML Form - Problem...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mike m

    Referencing PHP_SELF variable within HTML Form - Problem...

    all,

    I am developing a simple web site that contains a form page. The
    apps utilized are apache 2.0.48, php 4.3.4 on redhat 8.0. I have
    built a simple web form with one text box and a submit button. The
    result of pressing the submit button should be php echo'ing the input
    back to the screen. Attached is the tiny code snippet below:

    ----------------------------------------------
    <html>
    <head><title>PH P Forms Example</title></head>
    <body>
    <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
    Type a string: <input type="text" name="myString" ><br>
    <input type="Submit" name="submit" value="Submit
    Journal"><br><b r>
    </form>
    <?php
    print "You typed: $myString";
    ?>
    </body>
    </html>
    ----------------------------------------------

    The problem I am experiencing is that the print statement doesn't
    print anything back to output. If you notice, I changed the reference
    PHP_SELF due to 4.2.x modifications in php.ini.

    Any ideas?
    Mike
  • Adams-Blake Company

    #2
    Re: Referencing PHP_SELF variable within HTML Form - Problem...

    mike m wrote:
    [color=blue]
    > ----------------------------------------------
    > <html>
    > <head><title>PH P Forms Example</title></head>
    > <body>
    > <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
    > Type a string: <input type="text" name="myString" ><br>
    > <input type="Submit" name="submit" value="Submit
    > Journal"><br><b r>
    > </form>
    > <?php
    > print "You typed: $myString";
    > ?>
    > </body>
    > </html>
    > ----------------------------------------------
    >
    > The problem I am experiencing is that the print statement doesn't
    > print anything back to output. If you notice, I changed the reference
    > PHP_SELF due to 4.2.x modifications in php.ini.
    >
    > Any ideas?
    > Mike[/color]

    You probably have "register_globa ls" turned OFF.... which is now the
    default.

    Try : print "You typed:" . $_POST['myString'];

    and see what you get.

    Al Canton
    Adams-Blake Company, Inc.
    ***
    JAYA123 - the new web-based total-office system for the
    small biz. Order entry, billing, bookkeeping, etc. for $14.95
    a month. Everyone says "It's cool as a moose!!"
    See why at:http://www.jaya123.com
    ***

    Comment

    • Pedro Graca

      #3
      Re: Referencing PHP_SELF variable within HTML Form - Problem...

      mike m wrote:[color=blue]
      > The problem I am experiencing is that the print statement doesn't
      > print anything back to output. If you notice, I changed the reference
      > PHP_SELF due to 4.2.x modifications in php.ini.[/color]

      Because of the same thing you have to change $mystring

      Follow the other poster suggestion.
      --
      --= my mail box only accepts =--
      --= Content-Type: text/plain =--
      --= Size below 10001 bytes =--

      Comment

      • mike m

        #4
        Re: Referencing PHP_SELF variable within HTML Form - Problem...

        Pedro Graca <hexkid@hotpop. com> wrote in message news:<bt7hhf$44 c8n$1@ID-203069.news.uni-berlin.de>...[color=blue]
        > mike m wrote:[color=green]
        > > The problem I am experiencing is that the print statement doesn't
        > > print anything back to output. If you notice, I changed the reference
        > > PHP_SELF due to 4.2.x modifications in php.ini.[/color]
        >
        > Because of the same thing you have to change $mystring
        >
        > Follow the other poster suggestion.[/color]

        All,

        After reading this I was able to get this working. It helps to RTFM
        in more depth :)

        Thanks again for the quick response - I have dived into learning
        (struggling) php over the past 2 days; the newsgroup participants have
        been very helpful...

        Rgds,
        Mike M

        Comment

        Working...