Href Modal不起作用

时间:2018-07-31 01:20:25

标签: php sql

我是PHP新手。我的href模态无法完美运行。 我正在使用带有编辑项功能的数据库搜索。

在初始加载datatable时,编辑锚标记应在 模态形式。

但是它似乎不起作用。当我单击图标时,它什么也没做。 我在想搜索查询和div ID之间可能存在冲突?

这是我的代码:

我用于搜索查询的代码:

$sql_result = mysql_query ($sql, $conn ) or die ( "Could not execute SQL 
    query" .$sql);
if (mysql_num_rows($sql_result)>0) {
    while ($row = mysql_fetch_assoc($sql_result)) {
        $project=$row['Project'];
        $id=$row['ID'];
        $discipline=$row['Discipline'];
        $area_code=$row['Area_Code'];
        $drawingnumber=$row['Drawing_Number'];
        $documenttitle=$row['Document_Title'];
        $approveddate=$row['Approved_Date'];
        $revnumber=$row['Revision'];
        $status=$row['Status'];
        $transnumber=$row['Transmittal_No'];

        //table row
        <tr>
            <td><?php echo $project; ?></td>
            <td><?php echo $discipline; ?></td>
            <td><?php echo $area_code ;?></td>
            <td><?php echo $drawingnumber ;?></td>
            <td><?php echo $documenttitle; ?></td>
            <td><?php echo $approveddate; ?></td>
            <td><?php echo $revnumber; ?></td>
            <td><?php echo $status; ?></td>
            <td><?php echo $transnumber; ?></td>
            <td><?php echo $id; ?></td>
            <div class='btn-group' role='group' aria-label='...'>
                <td> <a href="#edit<?php echo $id;?>" data-toggle="modal"><button type='button' class='btn btn-warning btn-sm'>Edit<span class='glyphicon glyphicon-edit' aria-hidden='true'></span></button></a></td>
            </div>
        </tr>

我的href编辑方式:

<div id="edit<?php echo $id; ?>" class="modal fade" role="dialog">
    <form method="post" class="form-horizontal" role="form">
        <div class="modal-dialog modal-lg">
            <!-- Modal content-->
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">Edit Item</h4>
                </div>
                <div class="modal-body">
                    <input type="hidden" name="edit_item_id" value="<?php echo $id; ?>">
                    <div class="form-group">
                        <label class="control-label col-sm-2" for="discipline">Discipline:</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="discipline" name="discipline" value="<?php echo $id; ?>"  required autofocus>
                        </div>
                        <label class="control-label col-sm-2" for="area_code">Area Code:</label>
                        <div class="col-sm-4">
                            <input type="text" readonly class="form-control" id="area_code" name="area_code" value="<?php echo $area_code;?>"  required>
                        </div>
                        <label class="control-label col-sm-2" for="drawingnumber">Drawing Number:</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="drawingnumber" name="drawingnumber" value="<?php echo $drawingnumber; ?>"  required >
                        </div>
                        <label class="control-label col-sm-2" for="documenttitle">Document Title:</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="documenttitle" name="documenttitle" value="<?php echo $documenttitle; ?>"  required >
                        </div>
                        <label class="control-label col-sm-2" for="approveddate">Approved Date:</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="approveddate" name="approveddate" value="<?php echo $approveddate; ?>"  required>
                        </div>

                        <label class="control-label col-sm-2" for="revnumber">Revision Number:</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="revnumber" name="revnumber" value="<?php echo $revnumber; ?>"  required >
                        </div>
                        <label class="control-label col-sm-2" for="status">Status:</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="status" name="status" value="<?php echo $status; ?>"  required >
                        </div>
                        <label class="control-label col-sm-2" for="transnumber">Transmittal Number:</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="transnumber" name="transnumber" value="<?php echo $transnumber; ?>"  required >
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

0 个答案:

没有答案