473,396 Members | 2,052 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,396 software developers and data experts.

PHP control array syntax vs HTML standard

PHP allows control arrays in forms e.g. this is a counter editing script

echo "<input name=\"counterdelname[]\" type=\"hidden\" value=\"";

echo "<input name=\"countername[]\" type=\"hidden\"
value=\"".$namestr."\">";

echo "<input name=\"newvalue[]\" size=".VALUEWIDTH."
value=\"".$valuestr."\">";

echo "<input name=\"delcounter[".$namestr."]\" type=\"checkbox\">";

The resultant web page might look something like this, in part:

<td><font face="arial,helvetica" size=2><input
name="delcounter[www.mysite.co.nz:]" type="checkbox"></font></td>
<tr><td><font face="arial,helvetica" size=2><input name="countername[]"
type="hidden"
value="www.mysite.co.nz:/20040313/index.shtml">www.mysite.co.nz:/20040313
/index.shtml</font></td>

Control arrays in PHP offer significant advantages in processing form
input where there are a variable number of sets of the same elements
repeated multiple times down the page to allow a set of records of the
same data fields to be edited. The form elements are received back in the
processing script as an array which can be dealt with in a
straightforward for loop.

According to HTML 4.0 standards, the name of an Input element should
follow these conventions:

"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 (".")."

I don't see anything there about the square brackets which are part of
the PHP array syntax, but they seem to be accepted and PHP seems to be
able to turn all the elements it receives into an array on the submission
of the form to the processing script. Is there something in the CGI
conventions or HTML that it does permit this syntax?
Jul 17 '05 #1
21 6413
Patrick Dunford wrote:
According to HTML 4.0 standards, the name of an Input element should
follow these conventions:

"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 (".")."


The name attribute of form controls doesn't actually accept a NAME token as
its value, it accepts CDATA. For an example of an attribute that takes a
NAME token, see 'http-equiv'

http://www.w3.org/TR/html4/index/attributes.html

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Jul 17 '05 #2
On Tue, 30 Mar 2004 08:42:53 +1200, Patrick Dunford <pa************@nz.invalid>
wrote:
PHP allows control arrays in forms e.g. this is a counter editing script

The resultant web page might look something like this, in part:

<input name="countername[]" type="hidden"
value="www.mysite.co.nz:/20040313/index.shtml">

According to HTML 4.0 standards, the name of an Input element should
follow these conventions:

"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 (".")."

I don't see anything there about the square brackets which are part of
the PHP array syntax, but they seem to be accepted and PHP seems to be
able to turn all the elements it receives into an array on the submission
of the form to the processing script. Is there something in the CGI
conventions or HTML that it does permit this syntax?


You've misread the HTML standards; please see some previous discussions:

http://groups.google.co.uk/groups?hl...3801803&rnum=1
http://groups.google.co.uk/groups?hl...f3b43cf&rnum=2
http://groups.google.co.uk/groups?hl...3f07028&rnum=3

The name attribute of the <input> element is not of type NAME, it is of type
CDATA, and so [ and ] are valid characters within the value of that attribute.

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #3
Tim
On Tue, 30 Mar 2004 08:42:53 +1200,
Patrick Dunford <pa************@nz.invalid> posted:
www.mysite.co.nz:/20040313


This is a most unusual way to specify an address. Why have you put a colon
there?

Ordinarily, colons are used in that position to specify a different port to
use (instead of the standard port 80). e.g. http://www.example.com:8000/

Cross-posting to so many newsgroups isn't such a brilliant thing to do,
either.

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please delete some files yourself.
Jul 17 '05 #4
Verily, verily, on Tue, 30 Mar 2004 18:49:25 +0930 in nz.comp article
<14*******************************@40tude.net>, Tim
<ti*@mail.localhost.invalid> didst uttereth...
On Tue, 30 Mar 2004 08:42:53 +1200,
Patrick Dunford <pa************@nz.invalid> posted:
www.mysite.co.nz:/20040313
This is a most unusual way to specify an address. Why have you put a colon
there?

Ordinarily, colons are used in that position to specify a different port to
use (instead of the standard port 80). e.g. http://www.example.com:8000/


Colons is a convention in linux programs as a field separator.

Cross-posting to so many newsgroups isn't such a brilliant thing to do,
either.


I'm interested in the subject matter not netiquette or political
correctness dross
Jul 17 '05 #5
Els
Patrick Dunford wrote:
Cross-posting to so many newsgroups isn't such a brilliant thing to do,
either.


I'm interested in the subject matter not netiquette or political
correctness dross


Reminds me of an episide of Spongebob Squarepants, where the
fish behind the ticket window of the busstation didn't
understand Spongebob until he used the same language as the
fish.

--
Els

Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -

Jul 17 '05 #6
Patrick Dunford wrote:
http://www.mysite.co.nz/20040313

I'm interested in the subject matter not netiquette or political
correctness dross


You may be interested to know that URL of yours gives me a 404 error.

'Later
Peter

--
Peter aka Ulujain - Computing for Fun!
http://www.ulujain.org/
Jul 17 '05 #7
On Tue, 30 Mar 2004 22:25:13 +1200, Patrick Dunford
<pa************@nz.invalid> wrote:
I'm interested in the subject matter not netiquette or political
correctness dross


Then, as this is a free discussion forum, you may feel free to ignore
those aspects of the thread.
Jul 17 '05 #8
Tim
Tim wrote:
Cross-posting to so many newsgroups isn't such a brilliant thing to do,
either.


Patrick Dunford <pa************@nz.invalid> posted:
I'm interested in the subject matter not netiquette or political
correctness dross


When asking for help in the newsgroups, it's generally a good idea not to
piss off the people who might just help you. Demonstrating that you're not
interested in behaving yourself, and then going further by telling people
that you're not interested in behaving yourself, doesn't do anything to
help you, either.

Cross-posting isn't appreciated, even worse if you don't specify a
followup-to (so all replies get directed to one place). It's the sort of
thing that gets you instantly ignored by the people who know the most about
the problems you're asking about, and getting told not to do it by a lot of
other people. Making silly excuses about it just makes you look even
stupider.

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please delete some files yourself.
Jul 17 '05 #9
Verily, verily, on Wed, 31 Mar 2004 04:06:43 +0930 in nz.comp article
<12*****************************@40tude.net>, Tim
<ti*@mail.localhost.invalid> didst uttereth...
Tim wrote:
Cross-posting to so many newsgroups isn't such a brilliant thing to do,
either.

Patrick Dunford <pa************@nz.invalid> posted:
I'm interested in the subject matter not netiquette or political
correctness dross


When asking for help in the newsgroups, it's generally a good idea not to
piss off the people who might just help you. Demonstrating that you're not
interested in behaving yourself, and then going further by telling people
that you're not interested in behaving yourself, doesn't do anything to
help you, either.


The same applies to people who post time wasting replies.

Jul 17 '05 #10
On Wed, 31 Mar 2004 10:16:13 +1200, Patrick Dunford
<pa************@nz.invalid> wrote:

The same applies to people who post time wasting replies.


Except that the people writing these replies are the ones you need. You're
behaving a little more pompously than someone who wants help normally
behaves, and that's not speeding things up any.
Jul 17 '05 #11
Verily, verily, on Tue, 30 Mar 2004 17:24:40 -0500 in nz.comp article
<op**************@news.rcn.com>, Neal <ne*****@spamrcn.com> didst
uttereth...
On Wed, 31 Mar 2004 10:16:13 +1200, Patrick Dunford
<pa************@nz.invalid> wrote:

The same applies to people who post time wasting replies.


Except that the people writing these replies are the ones you need. You're
behaving a little more pompously than someone who wants help normally
behaves, and that's not speeding things up any.


There have been in this thread about two useful replies that stuck to the
subject.

There have been about a dozen time wasting replies.

When I post a question, I expect to see reasonable answers, which I got
from two or three people. Who told me that the answer was that the
attribute was defined in terms of CDATA, which has a different
definition.

The rest of the people, who post about top posting, spelling, cross
posting and other time wasting rants, can just get a life.

You may choose to justify your position, the fact of this matter is that
I have been reading newsgroups for many years, and have seen many
questions asked in computer related groups. The people who have something
worthwhile to contribute, and there are many, don't complain about
pointless crap like top posting, spelling errors or crossposts to only
three groups.

But you can guarantee some idiot will always come along and start
nitpicking and wasting time over something like that.
Jul 17 '05 #12
Verily, verily, on Tue, 30 Mar 2004 18:49:25 +0930 in nz.comp article
<14*******************************@40tude.net>, Tim
<ti*@mail.localhost.invalid> didst uttereth...
On Tue, 30 Mar 2004 08:42:53 +1200,
Patrick Dunford <pa************@nz.invalid> posted:
www.mysite.co.nz:/20040313


This is a most unusual way to specify an address. Why have you put a colon
there?

Ordinarily, colons are used in that position to specify a different port to
use (instead of the standard port 80). e.g. http://www.example.com:8000/


Those are URI specifications. That isn't a URI, if you looked at the spec
of the PHP code, it is a countername.
Jul 17 '05 #13
Verily, verily, on Tue, 30 Mar 2004 17:24:40 -0500 in nz.comp article
<op**************@news.rcn.com>, Neal <ne*****@spamrcn.com> didst
uttereth...
On Wed, 31 Mar 2004 10:16:13 +1200, Patrick Dunford
<pa************@nz.invalid> wrote:

The same applies to people who post time wasting replies.


Except that the people writing these replies are the ones you need. You're
behaving a little more pompously than someone who wants help normally
behaves, and that's not speeding things up any.


Except that YOU haven't contributed anything worthwhile to this thread so
far. You didn't answer my question about PHP, which is what this thread
is about.

There are two useful answers at the very top of this thread. Neither of
them whines about crossposting, spelling, top posting or all the other
whinging that happens in newsgroups.

The fact is, in some newsgroups there are idiots who waste my time and my
bandwidth flaming other people solely on these reasons.
Jul 17 '05 #14
On Wed, 31 Mar 2004 12:00:36 +1200, Patrick Dunford
<pa************@nz.invalid> wrote:
Except that YOU haven't contributed anything worthwhile to this thread so
far. You didn't answer my question about PHP, which is what this thread
is about.
Well tell you what. You don't want an answer from me, this is not my area.

So why am I posting in this thread? Both my previous posts have noted that
you're being quite the ass. I'd like to learn more about this myself. If
you're going to ignore the well-intentioned criticism of those in this
group who can help you, I fear the info you and I want to see won't alight.

Two replies could have been more if you hadn't been an ass. I'm simply
being honest about this.
There are two useful answers at the very top of this thread. Neither of
them whines about crossposting, spelling, top posting or all the other
whinging that happens in newsgroups.
And your snide responses came after these. Seems you don't plan on being a
discussing member of the forum, based on your responses to which we
replied. So why are you still here? You got your answers.

I don't go out of my way to be rude. I'm a really nice guy. I'm being
honest with you. Your responses were totally ignorant of conventions this
forum holds to be important. When you devalue them, you devalue US. Think
about that.
The fact is, in some newsgroups there are idiots who waste my time and my
bandwidth flaming other people solely on these reasons.


Then don't bait the flames. Read the ng, learn the protocol, and conform.
Jul 17 '05 #15
Neal
On Wed, 31 Mar 2004 12:00:36 +1200, Patrick Dunford
<pa************@nz.invalid> wrote:
Except that YOU haven't contributed anything worthwhile to this thread so
far. You didn't answer my question about PHP, which is what this thread
is about.


Well tell you what. You don't want an answer from me, this is not my area.

So why am I posting in this thread? Both my previous posts have noted that
you're being quite the ass. I'd like to learn more about this myself. If
you're going to ignore the well-intentioned criticism of those in this
group who can help you, I fear the info you and I want to see won't alight.

Two replies could have been more if you hadn't been an ass. I'm simply
being honest about this.
There are two useful answers at the very top of this thread. Neither of
them whines about crossposting, spelling, top posting or all the other
whinging that happens in newsgroups.


And your snide responses came after these. Seems you don't plan on being a
discussing member of the forum, based on your responses to which we
replied. So why are you still here? You got your answers.

I don't go out of my way to be rude. I'm a really nice guy. I'm being
honest with you. Your responses were totally ignorant of conventions this
forum holds to be important. When you devalue them, you devalue US. Think
about that.
The fact is, in some newsgroups there are idiots who waste my time and my
bandwidth flaming other people solely on these reasons.


Then don't bait the flames. Read the ng, learn the protocol, and conform.


I have not breached any newsgroup protocol. Crossposting while
discouraged is not a breach of netiquette.

Jul 17 '05 #16
I noticed that Message-ID:
<MP************************@news.paradise.net.nz > from Patrick Dunford
contained the following:
Then don't bait the flames. Read the ng, learn the protocol, and conform.


I have not breached any newsgroup protocol. Crossposting while
discouraged is not a breach of netiquette.


Crossposting, if appropriate, is perfectly acceptable and infinitely
preferable to multi posting. And it would be difficult to say that your
choice was inappropriate given the nature of the question.

However, saying that you are not interested in "netiquette or political
correctness dross" is not likely to endear you to the Usenet community
at large.

--
Geoff Berrow
Member, UK Usenet Committee
My opinions, not the committee's, mine.
Jul 17 '05 #17
Tim
On Wed, 31 Mar 2004 11:53:54 +1200, Patrick Dunford
<pa************@nz.invalid> posted:
There have been in this thread about two useful replies that stuck to the
subject.

There have been about a dozen time wasting replies.
Mostly written by someone attempting to justify their behaviour, with a
rather large amount of effort put in by that one arrogant sod to justify
their position that they'll do as they damn well please, and hang how
annoying it might be to the usenet community.

You posted a message, it's no-longer yours. You got answers, you got a
question (why did you have a colon in that place?), and got uppity about
it. You were also given advice that cross-posting isn't a brilliant thing
to do (which it isn't, for a multitude of reasons, no matter how relevant
someone might think it is to the groups included), and you got really
snotty about that advice. Bearing in mind the shortness of the original
comment, your response has been wholly over-the-top.
When I post a question, I expect to see reasonable answers, which I got
from two or three people. Who told me that the answer was that the
attribute was defined in terms of CDATA, which has a different
definition.

The rest of the people, who post about top posting, spelling, cross
posting and other time wasting rants, can just get a life.
The one who needs to get a life, is you. This is usenet, something gets
said, other people make comments, that's how it works, live with it. The
rest of use know how usenet works, and play ball. Some make some effort to
ensure the others play ball too. There's always the odd few loudmouth who
pisses off everyone by refusing to play along, and making a huge fuss about
why they shouldn't do so.
You may choose to justify your position,
The one attempting to do the "justifying" is you.
the fact of this matter is that I have been reading newsgroups for many
years
Then you ought to know better.
But you can guarantee some idiot will always come along and start
nitpicking and wasting time over something like that.


You can always guarantee that some twit who behaves in an annoying manner
will defend their right to be an annoying twit to the death, and making a
right fool of themselves in the process. Today, that twit is you.

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please delete some files yourself.
Jul 17 '05 #18
On Wed, 31 Mar 2004, Patrick Dunford wrote:
Except that YOU haven't contributed anything worthwhile to this thread so
far. You didn't answer my question about PHP, which is what this thread
is about.
In order to qualify for this group (comp.infosystems.www.authoring.html)
the thread needs to be about authoring HTML for the WWW.
The fact is, in some newsgroups there are idiots who waste my time and my
bandwidth flaming other people solely on these reasons.


Welcome to usenet. and to the killfile.

Jul 17 '05 #19
Tim
On Wed, 31 Mar 2004 11:53:54 +1200, Patrick Dunford
<pa************@nz.invalid> posted:
There have been in this thread about two useful replies that stuck to the
subject.

There have been about a dozen time wasting replies.


Mostly written by someone attempting to justify their behaviour, with a
rather large amount of effort put in by that one arrogant sod to justify
their position that they'll do as they damn well please, and hang how
annoying it might be to the usenet community.

You posted a message, it's no-longer yours. You got answers, you got a
question (why did you have a colon in that place?), and got uppity about
it. You were also given advice that cross-posting isn't a brilliant thing
to do (which it isn't, for a multitude of reasons, no matter how relevant
someone might think it is to the groups included), and you got really
snotty about that advice. Bearing in mind the shortness of the original
comment, your response has been wholly over-the-top.
When I post a question, I expect to see reasonable answers, which I got
from two or three people. Who told me that the answer was that the
attribute was defined in terms of CDATA, which has a different
definition.

The rest of the people, who post about top posting, spelling, cross
posting and other time wasting rants, can just get a life.


The one who needs to get a life, is you. This is usenet, something gets
said, other people make comments, that's how it works, live with it. The
rest of use know how usenet works, and play ball. Some make some effort to
ensure the others play ball too. There's always the odd few loudmouth who
pisses off everyone by refusing to play along, and making a huge fuss about
why they shouldn't do so.
You may choose to justify your position,


The one attempting to do the "justifying" is you.
the fact of this matter is that I have been reading newsgroups for many
years


Then you ought to know better.
But you can guarantee some idiot will always come along and start
nitpicking and wasting time over something like that.


You can always guarantee that some twit who behaves in an annoying manner
will defend their right to be an annoying twit to the death, and making a
right fool of themselves in the process. Today, that twit is you.


You have contributed nothing useful whatsoever to this thread.

I have not broken any netiquette.
Jul 17 '05 #20
Alan J. Flavell
On Wed, 31 Mar 2004, Patrick Dunford wrote:
Except that YOU haven't contributed anything worthwhile to this thread so
far. You didn't answer my question about PHP, which is what this thread
is about.


In order to qualify for this group (comp.infosystems.www.authoring.html)
the thread needs to be about authoring HTML for the WWW.


It is. It is about how to comply with HTML authoring standards with PHP
code, as PHP scripting has to be able to output HTML that a browser and
server will recognise and process properly.

Jul 17 '05 #21
You are *both* behaving like children. Please stop, or take it to email.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Jul 17 '05 #22

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

Similar topics

14
by: dam_fool_2003 | last post by:
Friends, cannot we malloc a array? So, I tried the following code: int main(void) { unsigned int y={1,3,6},i,j; for(i=0;i<3;i++) printf("before =%d\n",y); *y = 7; /* 1*/
7
by: James Mcguire | last post by:
Hi, I frequently do non-initialisation type structure assignment via casting: e.g. struct s{int i,j,k;} mys; .... mys=(struct s){3,4,5};
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
4
by: bienwell | last post by:
Hi all, Data displayed on the datalist control is bound by the column name of the dataset like this : <%# DataBinder.Eval(Container.DataItem, "title")%> Could I use an element of the array...
3
by: kk_oop | last post by:
Hi. I recently wrote a simple little template that defines an array that checks attempts to use out of bounds indexes. The only problem is that it does provide the use array style value...
45
by: VK | last post by:
(see the post by ASM in the original thread; can be seen at <http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/3716384d8bfa1b0b> as an option) As that is not in relevance to...
2
by: JJA | last post by:
I'm looking at some code I do not understand: var icons = new Array(); icons = new GIcon(); icons.image = "somefilename.png"; I read this as an array of icons is being built. An element of...
272
by: Peter Olcott | last post by:
http://groups.google.com/group/comp.lang.c++/msg/a9092f0f6c9bf13a I think that the operator() member function does not work correctly, does anyone else know how to make a template for making two...
18
by: mdh | last post by:
>From p112 ( K&R). Given an array declared as static char arr= { { 0,1,........},{0,1,.....}}; let arr be passed as an argument to f. f( int (*arr) ) {....} It is noted that the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.