我正在处理从其他位置回收的代码片段,原始工作正常,但修改后的代码只给我一个空白页面。我试图评论部分希望隔离问题,但我一直在打路。我知道这是一件简单的东西,我正在忽略但是我的大脑现在很痛,并想我会把它贴在这里,而我去外面尖叫过去的汽车以减轻一些挫折。
<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>
<?
}
?>
感谢所有可以提供帮助的人。
答案 0 :(得分:0)
答案 1 :(得分:0)
您可能会收到PHP错误。
尝试在include语句之前添加此代码:
<?php
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);
include('dbc.php');