php - 如何调试导致白屏的 PHP/HTML 页面?

标签 php html mysql

我正在处理的 PHP 页面出现问题。

我有一个 list.php,它从 MySQL 数据库调用数据,还有一个 config.php 作为我的数据库的连接页面。下面是我的 edit.php 页面,当我查看它时,它完全是空白的。我的代码哪里出错了?

URL 字符串 http://localhost/example/edit.php?id=382 (应该调用 382 的客户端 ID 进行编辑)`

<html>
    <body>
    <?php
    include('config.php');
    if(isset($_GET['cx_id']))
    {
        $id=$_GET['cx_id'];
        if(isset($_POST['submit']))
        {
            $name=$_POST['Name'];
            $address=$_POST['Address'];
            $query3=mysqli_query("update restrictedkeys set Name='$name', Address='$address' where cx_id='$id'");
            if($query3)
            {
                header('location:list.php');
            }
        }
        $query1=mysqli_query("select * from restrictedkeys where cx_id='$id'");
        $query2=mysqli_fetch_array($query1);
        ?>
        <form method="post" action="">
            Name:<input type="text" name="name" value="<?php echo $query2['Name']; ?>" /><br />
            Address:<input type="text" name="address" value="<?php echo $query2['Address']; ?>" /><br /><br />
            <br />
            <input type="submit" name="submit" value="update" />
        </form>
        <?php
        }
    ?>
    </body>
</html>

最佳答案

足够简单。仅当满足以下条件时才会打印您的表单:

if(isset($_GET['cx_id']))
{

由于网址是http://localhost/example/edit.php?id=382 ,实在不行。

将其更改为 http://localhost/example/edit.php?ctx_id=382你可能会得到一些不同的结果。

关于php - 如何调试导致白屏的 PHP/HTML 页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40731044/

相关文章:

php - 为所有 WooCommerce 产品启用永久审查复选框选项

php - 如何在php中传递两个参数并获取过滤结果?

php - XPath - 选择特定标签后的所有内容

html - 为什么在没有文本的情况下使用 flex 显示时会忽略行高?

mysql - 按名称 desc 分组 - 获取分组名称的最后输入值

php - 在 WordPress 中为自定义帖子类型存档添加元描述

html - 右对齐水平菜单 css/html

html - 如何在SVG旋转期间保持文本方向不变

java - 如何在MySql中将实体持久化为Json?

python - 在 Python 中调用 MySQL 存储过程 - 参数错误 # 不正确