[thelist] beginner PHP question
BT Bigpant
bigpant at btinternet.com
Mon Feb 18 16:07:01 CST 2002
To submit an array in a form, use either of these two formats:
<form ...>
<input ... name="item[]">
<input ... name="item[]">
<input ... name="item[]">
<input ... name="item[]">
<input ... name="item[]">
<input ... name="item[]">
</form>
or if you need to specify the array index explicitly:
<form ...>
<input ... name="item[0]">
<input ... name="item[1]">
<input ... name="item[2]">
<input ... name="item[3]">
<input ... name="item[4]">
<input ... name="item[5]">
</form>
this can also be used for select inputs:
<form ...>
<select multiple name="item[]">
<option...></option>
</select>
</form>
I believe it is possible to do multi-dimensional arrays as of php4.
use something like this to get the results:
while (list($key, $value) = each($item))
{
echo "item[$key] = $value<br>";
}
Get the php manual if you haven't got it. I recommend the pdf version.
http://www.php.net/download-docs.php
HTH
Phil Parker
More information about the thelist
mailing list