参见英文答案 >
“Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP 27个
我有一个可以设置密码保护的复选框 –
Password protect?
我的Php试图发布
$password = htmlspecialchars(strip_tags($_POST['password']));
我得到未定义的索引错误.
现在,如果我首先尝试检查密码是否已设置,我会得到相同的错误 –
$sql = "INSERT INTO blog (timestamp,title,entry,password) VALUES ('$timestamp','$title','$entry','$password')";
$result = mysql_query($sql) or print("Can't insert into table blog.
" . $sql . "
" . mysql_error());
我如何解决它?我是否必须为标题文本框等所有字段执行此操作?