1
我使用引導模式對話框時出現問題。 這是我的代碼:我想正確顯示id按鈕不只是打開模式對話框,但它不起作用。它始終顯示空白。 但如果我更改類型'按鈕'與'提交'得到正確的id但不顯示模式對話框。有什麼問題??感謝您的關注。這是我的代碼:已提交的Bootstrap模式對話框不顯示id值
<table class="table table-bordered">
<tr>
<td> <input type="checkbox" id="box1" name="box1"> <b>Seleziona tutto</b></td>
<td> <b>Pratica</b> </td>
<td> <b>Filiale</b> </td>
</tr>
<?php
$query = mysql_query("SELECT * from plprat ") ;
while ($row = mysql_fetch_array($query)) {
echo "<tr>";
echo "<td><input type='checkbox' class='box' name='box[]' value=".$row['id']."></td>";
echo "<td>" . $row['pratica'] . "</td>";
echo "<td>" . $row['filiale'] . "</td>";
//echo "<td><form method='POST' action='Cancella.php'><button type='submit' name='Cancella' class='btn btn-default' value=".$row['id'].">Cancella</button></form></td>";
echo "<td><form method='GET'><button type='button' id='modifica' name='modifica' data-toggle='modal' data-target='#myModal' class='btn btn-default' value=".$row['id'].">Modifica</button></form></td>";
echo "</tr>";
}
?>
</table>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modifica dati</h4>
</div>
<div class="modal-body">
<?php
$id = $_GET['modifica'];
echo $id;
$query = mysql_query("SELECT * FROM plprat WHERE id = $id");
while ($row = mysql_fetch_array($query)) {
?>
<b>Pratica</b> <input type="text" id="pratica" name="pratica" value="<?php echo $row['pratica']; ?>">
<b>Filiale</b> <input type="text" id="filiale" name="filiale" value="<?php echo $row['filiale']; ?>">
<?php
}
?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Chiudi</button>
<button type="submit" id="salva" name="salva" class="btn btn-primary">Modifica</button>
</div>
</div>
</div>
</div>
也許你有多個按鈕'modifica'。嘗試將其更改爲任何獨特的名稱,如'id ='modifica _「。$ row ['id']。」''。另外,爲什麼你用'form'包裝按鈕? –