我正在创建一个CRUD应用程序,在该应用程序中,我坚持检索数据以便可以对其进行进一步的编辑。
背景-此页面显示数据库中的标题。单击它之后,您可以查看与其相关的详细信息,包括标题,单位,类别,并且还显示一个编辑按钮。现在,当用户单击“编辑”按钮时,将显示一个用于更改该特定标题的模式。
`
<button type="button" class="btn btn-success btn-sm" data-toggle="modal" data-target="#facultyAddModal">Add Title</button>
<br><br>
<div class="panel-group" id="facultyAccordion">
<?php
for ($i = 0; $i < count($getAll); $i++) {
echo <<<HTML
<div class="panel panel-default">
<div class="panel-heading"><h4 class="panel-title">
<a data-toggle="collapse" data-parent="#facultyAccordion" href="#collapseF{$i}">{$getAll[$i]['title']}</a></h4>
</div>
<div id="collapseF{$i}" class="panel-collapse collapse">
<div class="panel-body">
<div class="table-responsive">
<table class="table table-condensed"><tbody>
<tr><td>Title:</td><td>{$getAll[$i]['title']}</td></tr>
<tr><td>Units:</td><td>{$getAll[$i]['units']}</td></tr>
<tr><td>Category:</td><td>{$getAll[$i]['category']}</td></tr>
<tbody></table>
</div>
<button type="button" class="btn btn-warning btn-sm" data-toggle="modal" data-target="#titleEditModal" onclick="titleEditModal('{$getAll[$i]['titleId']}')><span class="glyphicon glyphicon-edit" aria-hidden="true"></span> Edit Title</button>
</div>
</div>
</div>
HTML;
}
?>
</div>
<!-- Title Edit Modal -->
<div class="modal fade" id="titleEditModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Edit Title</h4>
</div>
<div class="modal-body">
<!-- Title edit Modal Fail Alert-->
<div id="adminResult" class="hide" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<div id="resultAdminContent"></div>
</div>
<!-- editTitle Form-->
<form id="editTitle" method="post">
<div class="form-group">
<label for="desc">Title:</label>
<input type="text" class="form-control" id="editadminTitle" name="title" value=""<?php echo $getdata['title'];?>"">
</div>
<div class="form-group">
<label for="desc">Units:</label>
<input type="text" class="form-control" id="editadminUnits" name="units" value=""<?php echo $getdata['units'];?>"">
</div>
<div class="form-group">
<label for="year">Category:</label>
<input type="text" class="form-control" id="editadminCategory" name="category" value="<?php echo $getdata['category'];?>" >
</div>
<input type="hidden" class="form-control" id="editadminTypeId" value=''>
<br>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
`
我希望数据以模式显示,以便用户对其进行更改。但是我在每个字段显示错误-'
通知:未定义索引: C:\ Apache24 \ htdocs \ PhpProject1 \ admin.php 在 103
'