Forum Moderators: coopster
The form counts the files in the directory and creates the form field based on the number of files it finds. Here is a stripped down version of the form script.
while ( list( $key, $fileName ) = each( $images ) )
{
if(!empty($fileName) )
{
echo " <td align=\"CENTER\" valign=\"TOP\"><IMG SRC=\"$path/$fileName\" border=0 alt=\"$count\"";
if (!empty($thumb_width)) {echo " width=\"$thumb_width\"";}
if (!empty($thumb_height)) {echo " height=\"$thumb_height\"";}
echo "></a><input name=\"graphic$count\" type=\"text\" value=\"$fileName;\"readonly=\"readonly\"> <input type=\"text\"";
echo "name=\"cap$count\"><br>";
if ($count == $break) {
echo "\n </td>\n</tr>\n<tr>\n";
$break = $count + $colunas;
}
else { echo "</td>\n"; }
}
$count++;
}
}
The form that writes the information formats and writes the data to a file.
$input = "$graphic1$cap1\n$graphic2$cap2\n$graphic3$cap3\n$graphic4$cap4\n";
This method works great if there are only 4 pictures, my problem is I do not know how many graphics there will be. Is there a better way to capture the data from this type of dynamic form and format it for writing?