PHP的功能已经实现,却总是报错
代码的目的是实现图片上传到指定目录,并且在mysql中记录图片路径。
现在目的已经实现,可是页面总是报错,
报错内容就是第二行:
- PHP code
<!---ecms Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?phpif ($_GET['action'] == "save"){ //这行报错:Notice: Undefined index: action in D:\xampp\htdocs\upload.php on line 2include_once('MYDBconn.php');include_once('UPclass.php');$titles=$_POST['title'];$images=$uploadfile;if($titles == "")echo"<script>window.alert('No title');history.back()</script>";$sql="insert into product(title,pic) values('$titles','$images')";$result=mysql_quer<strong style="color:transparent">本&文来源gao@daima#com搞(%代@#码网@</strong><textarea>搞gaodaima代码</textarea>y($sql,$conn);echo"<script>window.alert('congratunations');location.href='upload.php'</script>";}?><title>images transfer</title><body> <table border="0" cellspacing="0" cellpadding="0" align="center" width="100%"> <tr> <td width="55" height="20" align="center"> </TD> <td height="16"> <table width="48%" border="0" cellpadding="0" cellspacing="0"> <tr> <td>titles:</td> <td></td> </tr> <tr> <td>Images: </td> <td><label> </label></td> </tr> <tr> <td> </td> <td></td> </tr> </table> </td> </tr> </table>
麻烦指教一番,究竟是哪里出错了,谢谢
——解决方案——————–
if ( isset($_GET[‘action’]) && $_GET[‘action’] == “save” )
——解决方案——————–
上个问题帖子答过你了,在置顶的基础问题帖子里也有提到这个问题
这是一个提示不是错误
在传递过来的参数 包括post 在新版本,应该是5.3X的某个版本后需要做一个
isset进行判断,否则就会出现这个提示,当然你可以调整出错提示的等级来屏蔽这样的提示.