philip Wed Oct 31 03:05:52 2001 EDT
Modified files:
/phpdoc/en/faq html.xml
Log:
Expanded 'Arrays in forms' a bit.
Index: phpdoc/en/faq/html.xml
diff -u phpdoc/en/faq/html.xml:1.6 phpdoc/en/faq/html.xml:1.7
--- phpdoc/en/faq/html.xml:1.6 Sun Oct 14 07:55:30 2001
+++ phpdoc/en/faq/html.xml Wed Oct 31 03:05:51 2001
@@ -1,5 +1,5 @@
<?xml encoding="iso-8859-1"?>
-<!-- $Revision: 1.6 $ -->
+<!-- $Revision: 1.7 $ -->
<chapter id="faq.html">
<title>PHP and HTML</title>
<titleabbrev>PHP and HTML</titleabbrev>
@@ -45,7 +45,8 @@
</question>
<answer>
<para>
- To get your <form> result sent as an array to your PHP script
+ To get your <form> result sent as an
+ <link linkend="language.types.array">array</link> to your PHP script
you name the <input>, <select> or <textarea>
elements like this:
<programlisting>
@@ -68,23 +69,31 @@
]]>
</programlisting>
This produces two arrays, MyArray and MyOtherArray, that gets sent
- to the PHP script.
+ to the PHP script. It's also possible to assign specific keys
+ to your arrays:
+ <programlisting>
+<![CDATA[
+<input name="AnotherArray[]">
+<input name="AnotherArray[]">
+<input name="AnotherArray[email]">
+<input name="AnotherArray[phone]">
+]]>
+ </programlisting>
+ The AnotherArray array will now contain the keys 0, 1, email and phone.
</para>
<para>
<note>
<para>
- You need not use indices with arrays in HTML, although you can
- specify number or associative indices, so you can exactly specify
- what indices will contain the information provided by that
- input element. If you do not specify indices, the array gets
- filled in the order the elements appear in the form.
+ Specifying an arrays key is optional in HTML. If you do not specify
+ the keys, the array gets filled in the order the elements appear in
+ the form. Our first example will contain keys 0, 1, 2 and 3.
</para>
</note>
</para>
<para>
- For functions you can use to process these arrays once you get
- them into your scripts, please see the
- <link linkend="ref.array">Arrays section</link>.
+ See also
+ <link linkend="ref.array">Array Functions</link> and
+ <link linkend="language.variables.external">Variables from outside PHP</link>.
</para>
</answer>
</qandaentry>