<a href="" data-toggle="modal" class="update_pic" data_id = "$id" data-target="#update-modal"><img height="100px" width="100px" src="data:image/jpeg;base64,'.base64_encode($row['pestImage']).'"/><a/></td>';
echo"<td>$imagedesc $id</td>";
echo"<td>$pestname</td>";
echo"<td>$pesticide</td>";
echo"<td>
<form action='editpest.php?id=$id' method='POST'>
<button data-toggle='modal' class='btn btn-primary btn-sm btn-block' data-target='#update-modal'>Edit</button>
<br/>
<form action='../php/deletepest.php?id=$id' method='POST'>
<button class='btn btn-danger btn-sm btn-block'>Delete</button>
</form>
</td>";
echo'</tr>';
<div id="update-modal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h1 class="modal-title">Update Picture Pest</h1>
</div>
<div class="modal-body">
<?php echo" <form action='../php/updateImage2.php?id=$id' method='POST'>;"?>
<div style="position:relative;">
<div class="input-group image-preview">
<input type="text" class="form-control image-preview-filename" disabled="disabled"> <!-- don't give a name === doesn't send on POST/GET -->
<span class="input-group-btn">
<!-- image-preview-clear button -->
<button type="button" class="btn btn-default image-preview-clear" style="display:none;">
<span class="glyphicon glyphicon-remove"></span> Clear
</button>
<!-- image-preview-input -->
<div class="btn btn-default image-preview-input">
<span class="glyphicon glyphicon-folder-open"></span>
<span class="image-preview-input-title">Browse</span>
<input type="file" accept="image/png, image/jpeg, image/gif" name="input-file-preview"/> <!-- rename it -->
</div>
</span>
</div>
<br/>
<br/>
<div class="form-group">
<div class="col-lg-7 col-lg-offset-7.5">
<button type="submit" class="btn btn-primary btn-lg">Update Picture</button>
</div>
</div>
</form>
您好我想將從數據庫中檢索到的$ id的值傳遞給模態,因此我可以在更新圖像時將它用作Where子句。從窗體到模態在php中傳遞值
這是我的第一個問題,希望有人會回答
再試一次吧。 – Flosculus
請考慮修復代碼格式。 –
好的,我會看其他人的問題,以瞭解正確的格式。 –