表的代码是:
<?
$sql = 'select * from katalog';
$result = mysql_query($sql, $baza);
$provjera = mysql_num_rows($result);
php while ($row = mysql_fetch_assoc($result))
if ($provjera == ''){
echo '<td>Nemate otvorenih kataloga.</td>';
}else if ($provjera != ''){?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['naziv']; ?></td>
td><?php
$status = $row['status'];
if ($status == '1'){
echo 'Aktivno';
}else if ($status == '0'){
echo 'Neaktivno'; } echo '<td><a href="#uredimodal" class="btn-floating btn-large waves- effect waves-light orange modal-trigger" data-naziv="daa" data-status="'.$status.'"><i class="material-icons" style="color:white">mode_edit</i></a>|
<a class="btn-floating btn-large waves-effect waves-light red modal-trigger" href="#obrisiuredimodal" ><i class="material-icons" style="color:white">delete</i> Obriši</td></a>';
?><?php }} ?></td>
从代码中,当我点击橙色编辑按钮时,我看到我需要打开一些其他模块的数据。如何使用MODAL编辑表格中的某些数据? 表和模态在同一个PHP文件中。
模态代码:
<!-- Modal Editiranje -->
<div id="uredimodal" class="modal">
<div class="modal-content">
<h4>Uredi Katalog <?php echo $naziv;?></h4>
<form method="POST">
<div class="input-field col s12">
<label for="email" class="">Naslov Kataloga</label>
<input id="naslov" name="naslov" class="required validate" aria-required="true" type="text" value="<?php echo $row['naziv']; ?>" required>
</div>
<div class="input-field col s12">
<div class="select-wrapper"><span class="caret">▼</span><input class="select-dropdown" readonly="true" data-activates="select-options-cde9ce7d-c5d2-8deb-ad2c-e8a5668916c4" value="Choose your option" style="" type="text"><ul id="select-options-cde9ce7d-c5d2-8deb-ad2c-e8a5668916c4" class="dropdown-content select-dropdown" style="width: 458px; position: absolute; top: 0px; left: 0px; opacity: 1; display: none;">
<li class=""><span>Aktivno</span></li>
<li class=""><span>Neaktivno</span></li></ul>
<select id="status" name="status" class="initialized">
<option value="1">Akivno</option>
<option value="0">Neaktivno</option>
</select></div>
<label>Odaberite status kataloga</label>
</div>
</div>
<div class="modal-footer">
<button type="submit" style="float:right;" class="waves-effect waves-light btn m-b-xs"><i class="material-icons left">input</i>Spremi</button>
</div>
</form>
</div>