I have a checkbox which can make a post password protected-
<p><strong><label for="password">Password protect?</label></strong> <input type="checkbox" name="password" id="password" value="1" /></p>
My Php tries to post-
$password = htmlspecialchars(strip_tags($_POST['password']));
I get the undefined index error.
Now, if I try to check first if the password was set, I get the same error executing-
$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.<br />" . $sql . "<br />" . mysql_error());
How do I fix it? Do I have to do it for every field like title text box and all?