dot turns into underscore in form data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Ballard

    dot turns into underscore in form data

    Hi all,

    I've seen some weird (to me) behaviour where PHP (I think PHP is the
    culprit) turns dots into underscores in the names in my form data.
    Below is a simple example (play.php):

    <?php
    print "<html><head><t itle>Test Page</title></head><body>\n";
    foreach($_GET as $key => $value) {
    print $key . " => " . $value . "<p>\n";
    }
    print '<form method=GET action="play.ph p">';
    print '<input type=submit NAME="go.name" VALUE="go.value "><p>';
    print "</form>\n";
    print "</body></html>\n";
    ?>

    When I click on the "go.value" button, the URL I get is:



    But the returned page prints the following:

    go_name => go.value

    i.e. in the $_GET array, the key "go.name" has been turned into
    "go_name".

    (and POST does the same thing).

    As far as I can see, the HTML spec clearly allows the NAME field to
    contain the "." (dot) character. So why are my dots turning into
    underscores? Is this a PHP "feature", or something else?

    (I am running Apache on a RH9 Linux machine; with no non-default setup
    variables for either Apache or PHP, as far as I am aware).

    Any help appreciated.
    --
    Regards,

    Peter Ballard
    Adelaide, AUSTRALIA
    pballard@ozemai l.com.au

  • Jochen Daum

    #2
    Re: dot turns into underscore in form data

    Hi Peter,

    On 6 Apr 2004 20:28:28 -0700, pballard@ozemai l.com.au (Peter Ballard)
    wrote:
    [color=blue]
    >Hi all,
    >
    >I've seen some weird (to me) behaviour where PHP (I think PHP is the
    >culprit) turns dots into underscores in the names in my form data.
    >Below is a simple example (play.php):
    >
    ><?php
    >print "<html><head><t itle>Test Page</title></head><body>\n";
    >foreach($_GE T as $key => $value) {
    > print $key . " => " . $value . "<p>\n";
    >}
    >print '<form method=GET action="play.ph p">';
    >print '<input type=submit NAME="go.name" VALUE="go.value "><p>';
    >print "</form>\n";
    >print "</body></html>\n";
    >?>
    >
    >When I click on the "go.value" button, the URL I get is:
    >
    >http://localhost/play.php?go.name=go.value
    >
    >But the returned page prints the following:
    >
    >go_name => go.value[/color]

    Thats a feature of PHP, don't know why.

    Jochen
    --
    Jochen Daum - Cabletalk Group Ltd.
    PHP DB Edit Toolkit -- PHP scripts for building
    database editing interfaces.
    Download PHP DB Edit Toolkit for free. PHP DB Edit Toolkit is a set of PHP classes makes the generation of database edit interfaces easier and faster. The main class builds tabular and form views based on a data dictionary and takes over handling of insert/update/delete and user input.

    Comment

    • John Dunlop

      #3
      Re: dot turns into underscore in form data

      Peter Ballard wrote:
      [color=blue]
      > I've seen some weird (to me) behaviour where PHP (I think PHP is the
      > culprit) turns dots into underscores in the names in my form data.[/color]



      --
      Jock

      Comment

      • Tony Marston

        #4
        Re: dot turns into underscore in form data

        This behaviour is documented at
        http://www.php.net/manual/en/languag...s.external.php in the
        paragraph labelled "Dots in incoming variable names" (just below the one on
        "HTTP Cookies").

        --
        Tony Marston

        This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL



        "Peter Ballard" <pballard@ozema il.com.au> wrote in message
        news:9d5509fa.0 404061928.2d9bc 10@posting.goog le.com...[color=blue]
        > Hi all,
        >
        > I've seen some weird (to me) behaviour where PHP (I think PHP is the
        > culprit) turns dots into underscores in the names in my form data.
        > Below is a simple example (play.php):
        >
        > <?php
        > print "<html><head><t itle>Test Page</title></head><body>\n";
        > foreach($_GET as $key => $value) {
        > print $key . " => " . $value . "<p>\n";
        > }
        > print '<form method=GET action="play.ph p">';
        > print '<input type=submit NAME="go.name" VALUE="go.value "><p>';
        > print "</form>\n";
        > print "</body></html>\n";
        > ?>
        >
        > When I click on the "go.value" button, the URL I get is:
        >
        > http://localhost/play.php?go.name=go.value
        >
        > But the returned page prints the following:
        >
        > go_name => go.value
        >
        > i.e. in the $_GET array, the key "go.name" has been turned into
        > "go_name".
        >
        > (and POST does the same thing).
        >
        > As far as I can see, the HTML spec clearly allows the NAME field to
        > contain the "." (dot) character. So why are my dots turning into
        > underscores? Is this a PHP "feature", or something else?
        >
        > (I am running Apache on a RH9 Linux machine; with no non-default setup
        > variables for either Apache or PHP, as far as I am aware).
        >
        > Any help appreciated.
        > --
        > Regards,
        >
        > Peter Ballard
        > Adelaide, AUSTRALIA
        > pballard@ozemai l.com.au
        > http://members.ozemail.com.au/~pballard/[/color]


        Comment

        • Peter Ballard

          #5
          Re: dot turns into underscore in form data

          "Tony Marston" <tony@NOSPAM.de mon.co.uk> wrote in message news:<c50lh2$rt q$1$8300dec7@ne ws.demon.co.uk> ...[color=blue]
          > This behaviour is documented at
          > http://www.php.net/manual/en/languag...s.external.php in the
          > paragraph labelled "Dots in incoming variable names" (just below the one on
          > "HTTP Cookies").
          >
          > --
          > Tony Marston
          >
          > http://www.tonymarston.net
          >
          >
          > "Peter Ballard" <pballard@ozema il.com.au> wrote in message
          > news:9d5509fa.0 404061928.2d9bc 10@posting.goog le.com...[color=green]
          > > Hi all,
          > >
          > > I've seen some weird (to me) behaviour where PHP (I think PHP is the
          > > culprit) turns dots into underscores in the names in my form data.
          > > Below is a simple example (play.php):[/color][/color]

          [snip]

          Aha. I thought it might be in the manual somewhere, but sometimes it's
          not obvious where to look.

          Thanks to all who replied.

          --
          Regards,

          Peter Ballard
          Adelaide, AUSTRALIA
          pballard@ozemai l.com.au

          Comment

          Working...