I'm working with a form to update product catalog on my website.
Each product has name, price, description and images. I want the form can upload four images but the last three images is optional.
Ialready make the form like this :
<form method="post" action="input_product.php" enctype="multipart/form-data">
<table>
<tr>
<td width="200">Product Name</td>
<td width="5">:</td>
<td width="400"><input type="text" name="pro_name" width="250"></td>
</tr>
<tr>
<td width="200">Price</td>
<td width="5">:</td>
<td width="25"><input type="text" name="pro_price" width="250"></td>
</tr>
<tr valign="top">
<td width="200">Description</td>
<td width="5">:</td>
<td width="400"><textarea name="pro_desc cols="40" rows="5"></textarea></td>
</tr>
<tr valign="top">
<td width="200" valign="top">Thumbnail</td>
<td width="5">:</td>
<td width="400"><input type="file" name="image[]"></td>
</tr>
</tr>
<tr valign="top">
<td width="200" valign="top">Image 1</td>
<td width="5">:</td>
<td width="400"><input type="file" name="image[]"></td>
</tr>
</tr>
<tr valign="top">
<td width="200" valign="top">Image 2</td>
<td width="5">:</td>
<td width="400"><input type="file" name="image[]"></td>
</tr>
</tr>
<tr valign="top">
<td width="200" valign="top">Image 3</td>
<td width="5">:</td>
<td width="400"><input type="file" name="image[]"></td>
</tr>
<tr>
<td colspan="3"><input type="submit" value="Add Procdut"> <input type="button" value="Batal" onClick="self.history.back()"></td>
</tr>
</table>
</form>
I really confuse how to make php script to process this form where the number of image is optional and then save them into database.
Pls help....