<?php

// create divs of each new movie, along with form fields

for ($i=0;$i<$numMovies;$i++) {
	echo '<div class="row" id="newMovie' . $i . '">';
	echo $_SESSION["newMovies"][$i];
	echo "</div>\n";
	
	echo '<div class="newMovieFields" name="form' . $i . '" id="newMovieField' . $i . '">' . "\n";
	echo '<form action="verifyNew_addToDB.php" method="post"><table>' . "\n";
	echo '<tr><td class="leftCol"></td><td class="buttonTd"><input type="button" name="imdb" value="Autofill from IMDB" id="autoFill' . $i . '" title="Grab data from IMDB using Title field (and Year field, if filled in). If Title field is empty, will search IMDB using the filename." /></td></tr>' . "\n";
	echo '<tr><td class="leftCol">Title:</td><td><input type="text" name="title" id="title' . $i . '" /></td></tr>' . "\n";
	echo '<tr><td class="leftCol">Year:</td><td><input type="text" name="year" id="year' . $i . '" /></td></tr>' . "\n";
	echo '<tr><td class="leftCol">Director:</td><td><input type="text" name="director" id="director' . $i . '" /></td></tr>' . "\n";
	echo '<tr valign="top"><td class="leftCol">Description:</td><td><textarea name="description" id="description' . $i . '" rows="5"></textarea></td></tr>' . "\n";
	echo '<tr valign="top"><td class="leftCol">Cast:</td><td><textarea name="cast" id="cast' . $i . '" placeholder="Separate with commas" rows="3"></textarea></td></tr>' . "\n";
	echo '<tr><td class="leftCol">Genre:</td><td><input type="text" name="genre" id="genre' . $i . '" /></td></tr>' . "\n";
	echo '<tr><td class="leftCol">Tags:</td><td><input type="text" name="tags" id="tags' . $i . '" /></td></tr>' . "\n";
	echo '<tr><td class="leftCol">Artwork:</td><td><input type="text" name="artwork" id="artwork' . $i . '" /></td></tr>' . "\n";
	echo '<tr><td class="leftCol">I\'ve Seen It:</td><td><select name="seen" id="seen' . $i . '"><option value="0">No</option><option value="1">Yes</option></select></td></tr>' . "\n";
	echo '<tr><td class="leftCol">Rating:</td><td><select name="rating" id="rating' . $i . '"><option value="0">none</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></select></td></tr>' . "\n";
	echo '<tr><td class="leftCol"></td><td class="small">(Optional)</td></tr>';
	echo '<tr><td class="leftCol">Last Seen:</td><td><input type="text" name="lastseen" id="lastseen' . $i . '" placeholder="YYYYMMDD" /></td></tr>' . "\n";
	echo '<tr><td class="leftCol"></td><td class="small">(Optional. Overrides automatic timestamp)</td></tr>';
	echo '<tr><td class="leftCol">Date Added:</td><td><input type="text" name="timestamp" id="timestamp' . $i . '" placeholder="YYYYMMDD" /></td></tr>' . "\n";
	echo '<tr><td class="leftCol"></td><td class="buttonTd"><input type="hidden" name="index" value="' . $i . '" />' . "\n";
	echo '<input type="hidden" name="length" id="length' . $i . '" />' . "\n";
	echo '<input type="hidden" name="filename" id="filename' . $i . '" value="' . $_SESSION["newMovies"][$i] . '" />' . "\n";
	echo '<input type="reset" name="reset" value="Clear" /><br />' . "\n";
	echo '<input type="submit" name="submit" value="Submit" /></td></tr>' . "\n";
	echo '</table></form>' . "\n";
	echo '<div class="artworkPreview" id="artworkPreview' . $i . '"></div>' . "\n";
	echo '<div class="clear"></div>' . "\n";
	echo '</div>' . "\n\n";
}

?>