The first thing I see is that you have two consectuive else's here:
}else{
echo "<form action='".uploadSinglePicture()."'><table border='0' width='400' cellspacing='0' cellpadding='0' align=center>";
echo "<tr><td>Upload Image</td><td><input type=file name='images' class='bginput'></td></tr>";
echo "<tr><td><input name='submit' type='submit' value='Add Picture'/></td></tr>";
echo "</table></form>";
}
else{
$max_no_img=2; // Maximum number of images value to be set here
echo "<form action='".uploadTwoPictures()."'><table border='0' width='400' cellspacing='0' cellpadding='0' align=center>";
for($i=1; $i<=$max_no_img; $i++){
echo "<tr><td>Upload $i</td><td>
<input type=file name='images[".$i."]' class='bginput'></td></tr>";
}
Not knowing (or having the time to figure out) your logic, you'll need to determine if you just need a closing } before that 2nd else, or if the logic needs reworking.