首页 > 解决方案 > 跨度文本更改后页面变白?

问题描述

我有一个简单的 PHP 文件,它获取数据并将其显示在表格中。

当我使用按钮更改跨度文本时,页面变为白色。控制台中没有错误。当我向任何按钮添加功能或使用脚本更改某些内容时,也会发生这种情况。此外,当我按下提交按钮时,必须发送表单,然后页面必须自行刷新,但它也会返回一个白页。可能是什么问题呢?

<?php
   $connect = mysqli_connect($dbhost, $dbuser, $dbpass, $db_name);
   mysqli_set_charset($connect,"utf8");
 ?>
<!DOCTYPE html>
<html>
<body>
<form name="frmContact" method="post" action="denekkayit.php">
    <?php
        $result = mysqli_query($connect,"SELECT * FROM ****");
    ?>
    <table id="example" class="table is-striped" style="width:100%">
            
            <button type="submit" class="mdc-button mdc-button--stroked" onclick="spantext()">
                <i class="material-icons mdc-button__icon">grid_view</i>
                <span id="msg" class="mdc-button__label">Edit</span>
            </button>
            
            <input type="submit" name="Submit" id="Submit" value="Submit">
           
     
        <thead>
            <tr>
                <th ></th>
                <th >AAAAA</th>
                <th >BBBBBB</th>
            </tr>
        </thead>
        <tbody>
             <?php
                $j=0;
                while ($row = mysqli_fetch_assoc($result)) 
                {
                    echo
                    "
                <tr>
                    <td></td>
                    <td ><input type='text' id='ptwonumber[$j]'   name='AAAA[$j]'  value={$row['AAAA']}></td>
                    <td ><input type='text' id='wonumber[$j]'   name='BBBB[$j]'  value={$row['BBBB']}></td>
                    
                </tr>";
                $j=$j+1;
                };
            ?>
        </tbody>
</table>
</form>

</body>
</html>
<script>
function spantext()
{
    
    if($('#msg').text()=="Edit") 
    {$('#msg').text("Exit")}
    else {$('#msg').text("Edit")}
   
}
    $(document).ready(function() {
    $('#example').DataTable( {
        columnDefs: [ {
            width: 50,
            orderable: false,
            className: 'select-checkbox',
            targets:   0
        } ],
        select: {
            style:    'multi',
            selector: 'td:first-child'
        },
        "scrollY": screen.height/2.2,
        "scrollX": true,
        order: [[ 1, 'asc' ]]
    } );
} );
</script>

标签: javascriptphphtml

解决方案


推荐阅读