I am buidling a little script for my dad to speed up some html building he does. The form I've designed works like this:

1. Input number of products and Number of Rows
2. Use number of products to build input form consisting of tn (thumbnail), image, and description.
3. Process the form and build columns and rows

I can get 1 and 2 working just fine. I'm having trouble with processing the array from step 2 to step 3. Here is the code I wrote:

PHP Code:
<?


if ($action == "buildform"
    {
        echo 
"<form action=\"store.php\" method=\"post\">";
        for (
$i 1$i <= $products$i++) 
            {
            
// display form
            
echo "
                Thumbnail <input type=\"text\" name=\"items[]\"><br>
                Full Size Image <input type=\"text\" name=\"items[]\"><br>
                Descritpion<br> <textarea cols=\"50\" rows=\"5\" name=\"items[]\"></textarea><br><hr size=\"1\"><br>
            "
;            
            }
            echo 
"
                <input type=\"hidden\" name=\"action\" value=\"buildhtml\">
                <input type=\"hidden\" name=\"products\" value=\"
$products\">
                <input type=\"hidden\" name=\"rows\" value=\"
$rows\">
                <input type=\"submit\" name=\"submit\" value=\"submit\">
                </form>    
            "
;
    }
    

elseif (
$action == "buildhtml")
    {
        
$drows 0;
        echo 
"<table width=\"100%\"><tr>";
        foreach(
$items as $item => $value
            {
            
// build html
                
if( $drows $rows
                    { echo 
"</tr>\n<tr>"$drows 0; }
            echo 
"<td><a align=\"left\" href=\"$value\"><img src=\"$value\" border=\"1\"></a><font size=1>$value</font></td>\n";
            
            }
        echo 
"</tr></table>";
    }
    
else 
    {
    
// Default - display build form input
    
echo "
        <form action=\"store.php\" method=\"post\">
        How many products for this batch? <input type=\"text\" name=\"products\"><br>
        How many columns (not rows) for this batch? <input type=\"text\" name=\"rows\"><br>        
        <input type=\"hidden\" name=\"action\" value=\"buildform\">
        <input type=\"submit\" name=\"submit\" value=\"submit\">
        </form>    
    "
;
    }    



?>
I'm terrible at arrays.. any help is appreciated.

-Chris