There Has to be an easier way (Multidimensional Array_
| From: | Dev | Date: | Tue, 03 Dec 2002 15:45:45 +0000 |
| Subject: | There Has to be an easier way (Multidimensional Array_ | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-126873@lists.php.net to get a copy of this message | ||
Hello all
Currently I have a web fom that has 3 field in it that I want writing to a multidimensional array.
<TR>
<TD><INPUT TYPE="text" NAME="address[]" VALUE=""></TD>
<TD WIDTH="50" ALIGN="center"><INPUT TYPE="text" NAME="address[]['state']" VALUE="" SIZE="5" MAXLENGTH="5"></TD>
<TD COLSPAN="2"><INPUT TYPE="text" NAME="address[][]['zip']" VALUE=""></TD>
</TR>
in my page that processing this I have currently:
while(list($key,$value) = each($address)) {
if(!is_array($value)){
echo "$value ";
}
else {
while(list($key,$value1) = each($value)) {
if(!is_array($value1)){
echo "$value1 ";
}
else {
while(list($key,$value2) = each($value1)) {
echo "$value2";
}
}
}
}
echo "<BR>";
};
To read through it... I know there has to be a simpler way that I am missing. This way will not let me sort very well from what I see either.
Thank you in advance.