473,789 Members | 2,431 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP control array syntax vs HTML standard

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

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

echo "<input name=\"countern ame[]\" type=\"hidden\"
value=\"".$name str."\">";

echo "<input name=\"newvalue[]\" size=".VALUEWID TH."
value=\"".$valu estr."\">";

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

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

<td><font face="arial,hel vetica" size=2><input
name="delcounte r[www.mysite.co.n z:]" type="checkbox" ></font></td>
<tr><td><font face="arial,hel vetica" size=2><input name="counterna me[]"
type="hidden"
value="www.mysi te.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
21 6460
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.infosyste ms.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
8484
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
2538
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
3630
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
2224
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 (i.e. index=0) which has the name "title" in place of it ? For example:
3
1981
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 initialization when the type is instantiated. Any suggestions for a mod that would allow array initialization syntax? ***********Here's the type: #ifndef CHECKED_ARRAY_ #define CHECKED_ARRAY_
45
4863
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 "new Array() vs " question or to the array performance, I dared to move it to a new thread. Gecko takes undefined value strictly as per Book 4, Chapter 3, Song 9 of Books of ECMA :-)
2
2517
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 the array is an object itself but what is this syntax of the consecutive double quotes inside the brackets ?
272
14198
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 dimensional arrays from std::vectors ??? I want to use normal Array Syntax.
18
2062
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 parentheses are necessary else it would be
0
10193
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
10136
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9979
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7525
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
6761
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
5415
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...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4089
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
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.