Hello,
I have a simple form.
<form action="" method="post">
<label for="user">Name</label>
<input type="text" name="user" id="user" />
</br>
<label for="title">Title</label>
<input type="text" name="title" id="title" />
<textarea name="body" rows="20" cols="60"></textarea>
<input type="submit" value="Add Post" />
</form>
I am trying to insert this to a table, which I am able to do. But before I actually insert I wanted to validate the form. Simple validation: whether field is null or not. I used isset() function:
if(isset($_POST['user'], $_POST['title'], $_POST['body'])){
addPost(); // funtion that inserts record
header();
die();
}
I thought that isset() check for nulls, but when I submit an empty form, it still inserts to the table.
Can someone please explain this function to me, because from what I understand, isset() will return false when at least 1 of the parameters are null.
-drjay