我有一个表格来编辑有关餐厅的数据。然后,在表单中我放了一个按钮来删除图像。这是我的代码:
echo "<form name='form_update1' method='post' action='editrestaurant_post.php' enctype='multipart/form-data' >\n";
echo '<table width="50%">';
echo '<tr>';
echo '<td>Edit Restaurant</td>';
echo '</tr>';
echo '<tr>';
echo "<td> </td>";
echo '</tr>';
while ($fp = mysql_fetch_array($rsP)) { // loop as long as there are more results
$proid = mysql_real_escape_string($fp['proid']);
$proid = is_array($proid) ? $proid[count($proid)-1] : $proid;
echo '<tr>';
echo "<td> </td>";
echo "<td><input type='hidden' size='40' name='proid[$p]' value='{$fp['proid']}' /></td>";
echo '</tr>';
echo '<tr>';
echo "<td>Restaurant Name :</td>";
echo "<td><input type='text' size='40' name='resName[$p]' value='{$fp['resName']}' /></td>";
echo '</tr>';
$sqlPi= "SELECT * FROM pimage WHERE pimage.proid ='" . $proid . "'";
$rsPi = mysql_query($sqlPi) or die($sqlPi."<br/><br/>".mysql_error());
$pi = 0;
while ($fpi = mysql_fetch_array($rsPi)) {
$image = mysql_real_escape_string($fpi['image']);
$image = is_array($image) ? $image[count($image)-1] : $image;
$id = mysql_real_escape_string($fpi['id']);
$id = is_array($id) ? $id[count($id)-1] : $id;
echo "<form method='post' action='delete_image.php'>\n";
echo '<tr>';
echo "<td>Image :</td>";
echo "<td><img src='client_images".$fpi['image']."' width='50' height='50' ><input type='submit' name='deletepi' id='deletepi' value='Delete Image'></td>";
echo "<td><input type='hidden' size='40' name='imid' value='{$id}' /><input type='hidden' size='40' name='dir' value='{$image}' /><input type='hidden' size='40' name='e' value='{$e}' /></td>";
echo '</tr></form>';
++$pi;
}
++$p;
}
echo'<tr>
<td colspan="3" align="center"><input type="submit" name="button1" id="button1" value="Submit1"></td>
</tr>
</table>
</form>';
问题是当我单击删除按钮时,它会像主编辑餐厅表单一样执行操作。我怎么能解决这个问题?谢谢:D,非常感谢您的帮助