By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,826 Members | 1,333 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,826 IT Pros & Developers. It's quick & easy.

dot turns into underscore in form data

P: n/a
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><title>Test Page</title></head><body>\n";
foreach($_GET as $key => $value) {
print $key . " => " . $value . "<p>\n";
}
print '<form method=GET action="play.php">';
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
pb******@ozemail.com.au
http://members.ozemail.com.au/~pballard/
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi Peter,

On 6 Apr 2004 20:28:28 -0700, pb******@ozemail.com.au (Peter Ballard)
wrote:
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><title>Test Page</title></head><body>\n";
foreach($_GET as $key => $value) {
print $key . " => " . $value . "<p>\n";
}
print '<form method=GET action="play.php">';
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


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.
http://sourceforge.net/projects/phpdbedittk/
Jul 17 '05 #2

P: n/a
Peter Ballard wrote:
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.


http://groups.google.com/groups?th=ce40339b6955aef3

--
Jock
Jul 17 '05 #3

P: n/a
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" <pb******@ozemail.com.au> wrote in message
news:9d*************************@posting.google.co m...
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><title>Test Page</title></head><body>\n";
foreach($_GET as $key => $value) {
print $key . " => " . $value . "<p>\n";
}
print '<form method=GET action="play.php">';
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
pb******@ozemail.com.au
http://members.ozemail.com.au/~pballard/

Jul 17 '05 #4

P: n/a
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in message news:<c5*******************@news.demon.co.uk>...
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" <pb******@ozemail.com.au> wrote in message
news:9d*************************@posting.google.co m...
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):


[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
pb******@ozemail.com.au
http://members.ozemail.com.au/~pballard/
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.