473,767 Members | 2,152 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Posting name="abc def"

Hi !

If I have an input field

<form ... method="post">

<input type="text" name="abc def">

</form>

It always comes through as

$_POST["abc_def"]

I tried urlencode and rawurlencode and can't quite understand why it
is changed somwhere.

Converting " " to "_" is not quite what I want, because it should be
working with generated field names.

Any ideas?

Jochen
--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 16 '05 #1
6 3264
Jochen Daum wrote:
Hi !

If I have an input field

<form ... method="post">

<input type="text" name="abc def">

</form>

It always comes through as

$_POST["abc_def"]

I tried urlencode and rawurlencode and can't quite understand why it
is changed somwhere.

Converting " " to "_" is not quite what I want, because it should be
working with generated field names.

Any ideas?

Jochen


Yes. Use valid HTML.

Read the HTML 4.01 spec, specifically section 6.2:
(http://www.w3.org/TR/1999/REC-html40...tml#type-cdata)

To make it painfully obvious:
"ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed
by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"),
colons (":"), and periods ("."). "

A space is not valid inside of a name. Therefore, you should be happy that
PHP accepts it at all. (It may actually be the browser that's changing it
too, I'm not sure... the behaviour is undefined since it's not valid HTML.)
Jul 16 '05 #2
Hi Agelmar!

On Thu, 14 Aug 2003 01:25:55 -0400, "Agelmar"
<if**********@c omcast.net> wrote:
Jochen Daum wrote:
Hi !

If I have an input field

<form ... method="post">

<input type="text" name="abc def">

</form>

It always comes through as

$_POST["abc_def"]

I tried urlencode and rawurlencode and can't quite understand why it
is changed somwhere.

Converting " " to "_" is not quite what I want, because it should be
working with generated field names.

Any ideas?

Jochen
Yes. Use valid HTML.

Read the HTML 4.01 spec, specifically section 6.2:
(http://www.w3.org/TR/1999/REC-html40...tml#type-cdata)

To make it painfully obvious:
"ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed
by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"),
colons (":"), and periods ("."). "


Ok, I solved it by using

name="name[keyfield1;keyfi eld2]"

which at least works with spaces. Not a good idea I know.

However, . is turned into underscore by PHP, though its valid HTML
obviously. Just wondered, why this is.

Jochen

A space is not valid inside of a name. Therefore, you should be happy that
PHP accepts it at all. (It may actually be the browser that's changing it
too, I'm not sure... the behaviour is undefined since it's not valid HTML.)


--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 16 '05 #3
On Thu, 14 Aug 2003 01:25:55 -0400, "Agelmar"
<if**********@c omcast.net> wrote:
Jochen Daum wrote:
If I have an input field

<form ... method="post">

<input type="text" name="abc def">

</form>

It always comes through as

$_POST["abc_def"]

I tried urlencode and rawurlencode and can't quite understand why it
is changed somwhere.

Converting " " to "_" is not quite what I want, because it should be
working with generated field names.

Any ideas?

Jochen
Yes. Use valid HTML.


The above is valid HTML.
Read the HTML 4.01 spec, specifically section 6.2:
(http://www.w3.org/TR/1999/REC-html40...tml#type-cdata)

To make it painfully obvious:
"ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed
by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"),
colons (":"), and periods ("."). "

A space is not valid inside of a name. Therefore, you should be happy that
PHP accepts it at all. (It may actually be the browser that's changing it
too, I'm not sure... the behaviour is undefined since it's not valid HTML.)


The name attribute of the INPUT element is defined in the HTML DTD to
be of type CDATA, not of the restricted types ID or NAME.

There are no further restrictions on the values of the INPUT name
attribute listed in the specification.

See:

http://groups.google.com/groups?hl=e...3.30&frame=off

... starting with David K. Wall's post that made the same assertion,
and read mine and Tad McLellan's replies.

PHP applies its own restrictions on accepted values of the name
attribute, presumably inherited from the register_global s=on days;
names are restricted to those that are valid for PHP variable names,
and are rewritten using underscores for invalid characters.

Jul 16 '05 #4
Agelmar wrote:
Jochen Daum wrote:
Hi Agelmar!

On Thu, 14 Aug 2003 01:25:55 -0400, "Agelmar"
<if**********@c omcast.net> wrote:
Jochen Daum wrote:
Hi !

If I have an input field

<form ... method="post">

<input type="text" name="abc def">

</form>

It always comes through as

$_POST["abc_def"]

I tried urlencode and rawurlencode and can't quite understand why
it is changed somwhere.

Converting " " to "_" is not quite what I want, because it should
be working with generated field names.

Any ideas?

Jochen

Yes. Use valid HTML.

Read the HTML 4.01 spec, specifically section 6.2:
(http://www.w3.org/TR/1999/REC-html40...tml#type-cdata)

To make it painfully obvious:
"ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
followed by any number of letters, digits ([0-9]), hyphens ("-"),
underscores ("_"), colons (":"), and periods ("."). "


Ok, I solved it by using

name="name[keyfield1;keyfi eld2]"

which at least works with spaces. Not a good idea I know.

However, . is turned into underscore by PHP, though its valid HTML
obviously. Just wondered, why this is.

Jochen


No, it is not valid HTML. You are using a semicolon. This is not
valid. You can only use letters, numbers, hyphens, underscores,
colons, and periods. You may *not* use a semicolon. Did you even read
what I posted?


Hmm, nevermind, it seems as if I am incorrect. Read Andy's post for more
information.

Sorry.
Jul 16 '05 #5
Andy Hassall wrote:
On Thu, 14 Aug 2003 01:25:55 -0400, "Agelmar"
<if**********@c omcast.net> wrote:
Jochen Daum wrote:
If I have an input field

<form ... method="post">

<input type="text" name="abc def">

</form>

It always comes through as

$_POST["abc_def"]

I tried urlencode and rawurlencode and can't quite understand why it
is changed somwhere.

Converting " " to "_" is not quite what I want, because it should be
working with generated field names.

Any ideas?

Jochen
Yes. Use valid HTML.


The above is valid HTML.
Read the HTML 4.01 spec, specifically section 6.2:
(http://www.w3.org/TR/1999/REC-html40...tml#type-cdata)

To make it painfully obvious:
"ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
followed
by any number of letters, digits ([0-9]), hyphens ("-"), underscores
("_"),
colons (":"), and periods ("."). "

A space is not valid inside of a name. Therefore, you should be
happy that
PHP accepts it at all. (It may actually be the browser that's
changing it
too, I'm not sure... the behaviour is undefined since it's not valid
HTML.)


The name attribute of the INPUT element is defined in the HTML DTD to
be of type CDATA, not of the restricted types ID or NAME.

There are no further restrictions on the values of the INPUT name
attribute listed in the specification.

See:

http://groups.google.com/groups?hl=e...3.30&frame=off
... starting with David K. Wall's post that made the same assertion,
and read mine and Tad McLellan's replies.

PHP applies its own restrictions on accepted values of the name
attribute, presumably inherited from the register_global s=on days;
names are restricted to those that are valid for PHP variable names,
and are rewritten using underscores for invalid characters.


Hmm... interesting. Good to know. Personally though, I'll stick with names
valid in C :-)

Sorry to the original poster for my incorrect reply.
Jul 16 '05 #6
In article <o2************ *************** *****@4ax.com>,
jo*********@can s.co.nz says...
Hi Agelmar!

On Thu, 14 Aug 2003 01:25:55 -0400, "Agelmar"
<if**********@c omcast.net> wrote:
Jochen Daum wrote:
Hi !

If I have an input field

<form ... method="post">

<input type="text" name="abc def">

</form>

It always comes through as

$_POST["abc_def"]

I tried urlencode and rawurlencode and can't quite understand why it
is changed somwhere.

Converting " " to "_" is not quite what I want, because it should be
working with generated field names.

Any ideas?

Jochen


Yes. Use valid HTML.

Read the HTML 4.01 spec, specifically section 6.2:
(http://www.w3.org/TR/1999/REC-html40...tml#type-cdata)

To make it painfully obvious:
"ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed
by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"),
colons (":"), and periods ("."). "


Ok, I solved it by using

name="name[keyfield1;keyfi eld2]"

which at least works with spaces. Not a good idea I know.

However, . is turned into underscore by PHP, though its valid HTML
obviously. Just wondered, why this is.

Jochen

A space is not valid inside of a name. Therefore, you should be happy that
PHP accepts it at all. (It may actually be the browser that's changing it
too, I'm not sure... the behaviour is undefined since it's not valid HTML.)



Well, the . is the concatenation operator in PHP, so they need to be
changed to something that is valid in a PHP variable name.

--
Quod subigo farinam

$email =~ s/oz$/au/o;
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?
Jul 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6242
by: Michael Schutte | last post by:
I know, questions about Tkinter and threads have been answered very often, but I want to ask anyway. I am using Python 2.2 on a Linux (SuSE Linux 8.1) system. I want to write a server application; like telnet is a client. The user should be able to bind() to a port and wait for a client. The written and recieved data is stored in a Text widget, self.__text. The accept()ing is done in a seperate thread (using the threading module), in...
3
11904
by: Sean Berry | last post by:
How do I rectify this? ------vars.py------ #!/usr/local/bin/python def setUserid(value): userid = value def getUserid():
17
1927
by: Istvan Albert | last post by:
Paul McGuire wrote: > Please reconsider the "def f() :" construct. Instead of > invoking a special punctuation character, it uses context and placement, > with familiar old 's, to infuse the declaration of a function with special > characteristics. If this causes def lines to run longer than one line, > perhaps the same rule that allows an unmatched "(" to carry over multiple > lines without requiring "\" continuation markers could be...
9
3616
by: msnews.microsoft.com | last post by:
Hello! I'm Jim by asp How can show "abc" in textbox when click one botton?
9
2777
by: shannonl | last post by:
Hi all, For some reason this bind is calling the donothing function, like it should, but is then allowing the text to be inserted into the Text widget. Here is the code: self.framebody.tag_config("name", underline=1) self.framebody.tag_bind("name", "<Any-KeyPress>", self.donothing)
1
3887
by: srinu | last post by:
Hello, We had one webserver based on a linux machine. The website is fully function and designed by a different person. Now we moved the machine from one IP to another one. I changed the machine ip address and the website is working partially. That site is working in between pages verywell. But once I give some input and requrest for data it is failing with the following message:
1
5237
by: Gregor Horvath | last post by:
Hi, I searched the web and docs but cannot figure out whats wrong with this code: #!/usr/bin/python import Tkinter as Tk class testtk(Tk.Frame):
1
17254
by: alain MONTMORY | last post by:
Hello everybody, I am a newbie to python so I hope I am at the right place to expose my problem..... :-http://www.python.org/doc/2.4.2/ext/pure-embedding.html 5.3 Pure Embedding I download the code example from http://www.python.org/doc/2.4.2/ext/run-func.txt I call the file "TestOfficiel.c" and I compile it with : gcc -g -I/usr/include/python2.3/ TestOfficiel.c -o TestOfficiel -lpython2.3 -ldl all is OK (or seems to be...).
6
2310
by: Dick Watson | last post by:
I had a page that works when setup like this: === <form name="frmCalc" action=""> <script type="text/javascript"> function btnCalc_onclick(abc) { return "got here with " + abc; }
0
9571
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9405
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10169
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10013
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7383
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5280
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3930
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3533
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.