以下是我上传单张图片的代码。但我想一次上传3张图片。
我该怎么做?
<form enctype="multipart/form-data" action="process2.php" method="POST">
<table id="tbl1">
<tr>
<td>For Sale </td>
<td colspan="2">
<input type="hidden" name="id"/>
</td>
</tr>
<tr>
<td>Type: </td>
<td colspan="2">
<select name="type" id="slct"><option>Residential</option></select></td>
</tr>
<tr>
<td>State: </td><td colspan="2">
<select name="state" id="slct"><option>Punjab</option></select></td>
</tr>
<tr>
<td>City: </td><td colspan="2">
<select name="city" id="slct"><option>Lahore</option></select></td>
</tr>
<tr>
<td>Location: </td><td colspan="2">
<input name="location" placeholder="Enter Location Here" id="slct2" type="text" /></td>
</tr>
<tr>
<td>Bedrooms:</td><td colspan="2">
<select name="bedroom"><option>1</option></select></td>
</tr>
<tr>
<td>Land In: </td><td colspan="2">
<select name="landtype" id="slct"><option>Kanal</option></select>
</tr>
<tr>
<td>Land Area: </td><td colspan="2">
<input name="landarea" placeholder="Enter area here" id="slct2" type="text" /></td>
</tr>
<tr>
<td>Price: </td><td colspan="2">
<input name="price" placeholder="Enter price here" id="slct2" type="text" /></td>
</tr>
<tr>
<td>Photo</td>
<td ><input type="file" name="photo" id="file"/></td>
</tr>
<tr>
<td>User Details</td>
<td colspan="2">
</td>
</tr>
<tr>
<td>Name: </td><td colspan="2">
<input name="name" placeholder="full name" id="slct2" type="text" /></td>
</tr>
<tr>
<td>Mobile: </td><td colspan="2">
<input name="mobile" placeholder="format 03001234567" id="slct2" type="text" /></td>
</tr>
<tr>
<td>E-mail: </td><td colspan="2">
<input name="email" placeholder="Enter email Here" id="slct2" type="text" /></td>
</tr>
<tr>
<td></td><td colspan="2"><input type="submit" name="submit" value="Post"/></td>
</tr>
</table>
</form>
答案 0 :(得分:0)
在HTML中添加代码
<td>Photo1</td><td ><input type="file" name="photo1" id="file1"/></td>
<td>Photo2</td><td ><input type="file" name="photo2" id="file2"/></td>
在您的html中添加此代码,并检查“process2.php”中选定的图像,这些图像已选择存储在您的数据库中。
当您在数据库中插入此图像时,只需执行“img1,img2,img3”将其存储在图像列中...如果您的要求仅为3张图像,则这是最简单的方法,然后您可以按照此步骤进行操作。 / p>