|
Posted by Second_Chance on 10/02/54 11:16
Oli Filth wrote:
> Second_Chance wrote:
>
>>I have a page showing several records - each table record is
>
> contained
>
>>within a separate form and has action buttons that submit (for
>>update/delete etc).
>>
>>I generate the html using a php loop, which adds the loop counter to
>>inputs name and id (to ensure unique id's).
>>This results in the $_POST array receiving results as "budgetname1",
>
> or
>
>>"budgetname2" etc.
>>
>>Do I have to parse the POST array, when what i really want is just
>>"budgetname" in the POST array, no matter which record the user
>
> clicks
>
>>on (the values tell me what i need!).
>>Although the page works if I assign the same id's in each form, the
>
> HTML
>
>>spec seems to suggest that a) id's must be unique in the document
>
>
> id attributes of HTML controls don't affect the POST variable name,
> only the name attribute. So just make all the name attributes the same.
>
>
>>b) that name and id must be the same
>
>
> Where does it say that??
>
> > and c) that "[]" characters are not permitted in HTML 4.01
>
> And where does it say that?
> Using [0], [1], [2], etc. is the recommended way of getting an array as
> a POST variable in PHP.
>
Oli, thanks for reply..
re c) I read the following at:
http://www.w3.org/TR/html4/types.html#type-id
"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 ("."). "
from which I assume [] are not ok
re b) that name and id must be the same
I can't find the section, think was in the same spec.. and said that if
both name and id attributes are set they should be the same (and name
was now deprecated..)
the last bit is here:
from this page:
www.w3.org/TR/html4/interact/forms/html#h-17.1
name = cdata [CI]
This attribute names the element so that it may be referred to from
style sheets or scripts. Note. This attribute has been included for
backwards compatibility. Applications should use the id attribute to
identify elements.
However, I am quite new at this, so will follow your suggestions
many thanks
Chris
Navigation:
[Reply to this message]
|