Last Updated: 20 Oct 2023
|
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
front-end-tech:javascript:using-php-input-arrays-with-javascript [May 9, 2008 06:33 AM] dordal |
front-end-tech:javascript:using-php-input-arrays-with-javascript [Oct 20, 2023 11:50 AM] 110.249.201.21 removed |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | = Using PHP Input Arrays with Javascript = | ||
+ | PHP allows you to name multiple form elements with the same name (appended by square brackets): | ||
+ | |||
+ | <code html> | ||
+ | <form name=' | ||
+ | <input type=' | ||
+ | <input type=' | ||
+ | <input type=' | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | When you submit this, the '' | ||
+ | <code javascript> | ||
+ | document.forms[' | ||
+ | </ | ||
+ | because the square brackets are illegal in an identifier in Javascript, even though they are legal in HTML. (In fact, that would try to access the '' | ||
+ | <code javascript> | ||
+ | document.forms[' | ||
+ | </ | ||
+ | Since '' |