473,408 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

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><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
4 6588
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
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: jason | last post by:
How do I seperate the "chk_" and "33" in the following string: chk_33 Thanks Jason
5
by: Walter Tross | last post by:
Somebody with a very regulatory mind in this newsgroup has written that it's better not to use a leading underscore for class member names, because names with a leading underscore are used...
10
by: Axter | last post by:
Section 17.4.3.1.2 states that each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace. Exactly what defines the implementation? ...
2
by: Antonio | last post by:
I have a datagrid which pulls from a stored procedure. For the purpose of this display issue, we need to prepend a bound column with a underscore "_" We don't want to change the stored procedure....
5
by: Rich | last post by:
I typed &myBtn to display the underscore line on the first letter of <u>M</u> of myBtn. I can invoke &myBtn by pressing alt-m on the keyboard. But the underscore is not showing up. Is there a...
16
by: Jim Langston | last post by:
I know that functions starting with an underscore, or two underscores, are reserved by the compiler/c++ and should not be used by the user and may cause undefined behavior. My question is, how...
14
by: Bit Byte | last post by:
I have the following struct: typedef struct { string symbol; string synonym; Synonym(string _synonym, string _symbol) { synonym = _synonym; symbol = _symbol; }
1
by: Barkster | last post by:
I have a field that contains an underscore. How can I do a query for the underscore since I just found that underscore really doesn't find underscore it is a wildcard in mysql. I need to be able...
4
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4. I notice for form elements that contain spaces, PHP substitutes an underscore for the element name when the form is submitted. For example, if I have this page...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.