drfkl66684 2016-11-21 23:06
浏览 139
已采纳

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

I am having issues with a PHP page I'm working on.

I have a list.php which is recalling data from a MySQL database, a config.php as a connection page to my db. Below is my edit.php page and when I view it, it's completely blank. Where is my code gone wrong?

URL string http://localhost/example/edit.php?id=382 (which should be recalling the client id of 382 to edit)`

<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>
  • 写回答

1条回答 默认 最新

  • dowjgrm6787 2016-11-21 23:12
    关注

    Simple enough. Your form will only be printed if this condition match:

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

    Since the url is http://localhost/example/edit.php?id=382, it would really not work.

    Change it to http://localhost/example/edit.php?ctx_id=382 and you might get some different result.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看