我将从我的服务器上运行的文件传输到本地计算机。未定义的索引
而且它抛出很多关于我的变量未定义指数,
请告诉我可能是什么问题,因为它的工作原理以及在互联网上,而不是在本地工作
下面是错误和相关的代码
“通知:未定义指数:添加在 /Users/mgltd/Sites/reacheasy/youraccount.php第27行的通知: 未定义指数:SNAME在/Users/mgltd/Sites/reacheasy/youraccount.php 在线30注意:未定义的索引: 中的Pname在线31上使用/Users/mgltd/Sites/reacheasy/youraccount.php注意: 未定义的索引:Pidno位于/Users/mgltd/Sites/reacheasy/youraccount.php 行32注意:未定义的索引:在第33行的 /Users/mgltd/Sites/reacheasy/youraccount.php的Psize注意: 未定义的索引:Pcolour在 /Users/mgltd/Sites/reacheasy/youraccount.php在线34注意: 未定义指数:Pquantity在 /Users/mgltd/Sites/reacheasy/youraccount.php线路35上注意: 未定义指数:网络链接在 /Users/mgltd/Sites/reacheasy/youraccount.php在线路36上的通知: 未定义索引:价格在/Users/mgltd/Sites/reacheasy/youraccount.php在线37上的注意:未定义的索引:注释 /Users/mgltd/Sites/reacheasy/youraccount.php在线38警告: date():依靠系统的时区设置是不安全的。你 是要求使用date.timezone设置或 date_default_timezone_set()函数。如果您使用这些 方法中的任何一种,并且您仍然收到此警告,则极有可能是 拼写错误的时区标识符。我们选择了 '欧洲/伦敦' 为 'BST/1.0/DST',而不是在/Users/mgltd/Sites/reacheasy/youraccount.php 在线39"
代码
<?php
$submit = $_POST['Add'];
//form data
$Sname = mysql_real_escape_string(htmlentities(strip_tags($_POST['Sname'])));
$Pname = mysql_real_escape_string(htmlentities(strip_tags($_POST['Pname'])));
$Pidno = mysql_real_escape_string(htmlentities(strip_tags($_POST['Pidno'])));
$Psize = mysql_real_escape_string(htmlentities(strip_tags($_POST['Psize'])));
$Pcolour = mysql_real_escape_string(htmlentities(strip_tags($_POST['Pcolour'])));
$Pquantity = $_POST['Pquantity'];
$Weblink = mysql_real_escape_string(htmlentities(strip_tags($_POST['Weblink'])));
$Price = mysql_real_escape_string(htmlentities(strip_tags($_POST['Price'])));
$comment = mysql_real_escape_string(htmlentities(strip_tags($_POST['comment'])));
$date = date("Y-m-d");
//echo " ('','$Sname','$Pname','$Pidno','$Psize','$Pcolour','$Pquantity','$Weblink','$Price','$Uname')";
if('POST' === $_SERVER['REQUEST_METHOD'])
{
if ($Sname&&$Pname&&$Pidno&&$Weblink&&$Price)
{
if (is_numeric($Price))
{
$repeatheck = mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}' AND Pidno ='$Pidno' AND Sname='$Sname' AND Pname='$Pname'");
$count = mysql_num_rows($repeatheck);
if($count!=0)
{
die ('PRODUCT ALREADY IN BASKET YOU CAN INCREASE OR DECREASE QUANTITY, <a href="youraccount.php">CLICK TO GO BACK TO YOUR LIST</a>');
}
else
//echo'$Price';
$tprice = $Price * $Pquantity;
//echo"$tprice";
$queryreg = mysql_query("
INSERT INTO repplac VALUES ('','$Sname','$Pname','$Pidno','$Psize','$Pcolour','$Pquantity','$Weblink','$Price','$comment','$tprice','$date','{$_SESSION['username']}','')
")or die(mysql_error());
}
else
echo 'price field requires numbers';
}
else
echo 'please fill in all required * fields ';
}
?>
<form action='youraccount.php' method='Post' class='ilistbar'>
<!--<div>
<label for='shoppinglist' class='fixedwidth'></label>
<textarea type='text' name='shoppinglist' id='username' cols='100' rows='15'></textarea>
</div> -->
<div>
<label for='Sname' class='fixedwidth'> * Shop name</label>
<input type='text' name='Sname' id='Sname'/>
</div>
<div>
<label for='Pname' class='fixedwidth'> * Product name</label>
<input type='text' name='Pname' id='Pname'/>
</div>
<div>
<label for='Pidno' class='fixedwidth'> * Product id no /ad reference</label>
<input type='text' name='Pidno' id='Pidno'/>
(This should be unique for each product)
</div>
<div>
<label for='Psize' class='fixedwidth'>Product size</label>
<input type='text' name='Psize' id='Psize'/>
</div>
<div>
<label for='Pcolour' class='fixedwidth'>Product colour</label>
<input type='text' name='Pcolour' id='Pcolour'/>
</div>
<div>
<label for='Pquantity' class='fixedwidth'>Product quantity</label>
<select name="Pquantity" id="Pquantity">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
(You can update quantity in excess of 10 on the shopping list below)
</div>
<div>
<label for='Weblink' class='fixedwidth'> * Web link</label>
<input type='text' name='Weblink' id='Weblink'/>
</div>
<div>
<label for='Price' class='fixedwidth'> * Price GBP</label>
<input type='text' name='Price' id='Price'/>
Please valid format is (.) for decimal
</div>
<div>
<label for='comment' class='fixedwidth'> Extra info</label>
<input type='text' name='comment' id='comment'/>
Please give different colours , sizes of the same products,discount codes, and other information that you would like us to use
</div>
<div>
<div class='buttonarea'>
<p>
<input type='submit' name='submit' value='Add'>
</p>
</div>
</p>
</form>
它也在服务器上失败。你从来没有听说过它。 – 2012-07-11 13:44:58
这是因为您没有将服务器PHP设置为显示警告。代码的工作原理是一样的,你之前没有看到警告。 – JJJ 2012-07-11 13:46:44
这是一些高质量的代码和错误消息,我告诉你什么。 – nickb 2012-07-11 13:49:06