dongse7261 2014-01-23 17:12
浏览 30
已采纳

PHP / MYSQL的空白页面

I am working on a snippet of code recycled from another location and the original works fine but the modified one just gives me a blank page. I have tried commenting out sections in hopes of isolating the problem but I keep hitting a road block. I know it is something simple and something I am overlooking but I my brain hurts now and figured I would post it on here while I went outside to scream at passing cars to relieve some frustration.

    <TITLE> Add Item </TITLE>
<?php

include("dbc.php");

if(isset($_POST['submit']))
        {
        $material = $_POST['material'];
        $dimmention = $_POST['dimmention'];
        $size = $_POST['length'];
        $color = $_POST['color'];

        if(!$material)
                {
                echo "Error: Material is a required field. Please fill it.";
                exit();
                }

        $result = mysql_query("INSERT INTO list (mat, date, dim, size, color)
        VALUES ('$material',NOW (),'$dimmention','$size','$color')",$connect);
        echo "<b>Thank you! Item added Successfully!<br>You'll be redirected to Home Page after (4) Seconds";
        echo "<meta http-equiv=Refresh content=4;url=index.php>";

        }
else
        {
        ?>
        <br>
        <h3>::Add Item</h3>
        <form method="post" action="<?php echo $_SERVER[PHP_SELF] ?>">
        Material (Alum, Galv, Steel): <input name="material" size="6" maxlength="6">
        <br>
        Dimentions (1 x 2 Patio, 2 x 2 090): <input name="dimmention" size="50" maxlength="100">
        <br>
        Size (24, 30, 15): <input name="length" size="5" maxlength="5">
        <br>
        Color (bronze, white, MF): <input name="color" size="6" maxlength="6">
        <br>
        <input type="submit" name="submit" value="Add Item">
        </form>
        <?
        }

?>

Thanks to all who can help.

  • 写回答

2条回答 默认 最新

  • dqdt45183 2014-01-23 17:16
    关注

    My initial assumption is that you have short open tags turned off in your ini file. Change the bottom of the page from this:

    <?
    
      }
    
    ?>
    

    To this:

    <?php
    
      }
    
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM