Php database error

hello friends i am new in php ,want to add form with database ,but a error appeared ,

( ! ) Notice: Undefined variable: name in C:\wamp\www\your_mail\register.php on line 26 Call Stack # Time Memory Function Location 1 0.0521 142664 {main}( ) …\register.php:0
( ! ) Notice: Undefined variable: email in C:\wamp\www\your_mail\register.php on line 26 Call Stack # Time Memory Function Location 1 0.0521 142664 {main}( ) …\register.php:0

this is my code can anyone help me.

if(isset($_POST['name'])){
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
}
$query = "INSERT INTO users
  (id,name,email,password,added_date,modified_date,status)
VALUES
  ('','$name','$email','$password','NOW()','','0') ";

Your SQL query isn’t inside your if statement, so if those $name and $email variables aren’t set, PHP outputs a notice error saying that it can’t find them. If you put the SQL statement inside the if statement, it should solve your problem.

Thanx Patche , i got it,but can you tell me why and where we use isset , i am confused with it.

isset() is a predicate language construct; it returns TRUE if the variable exists in memory, or FALSE if it does not. For a variable to exist, it must not have a NULL value. This means that anything but a NULL value (including empty values, ‘’) will result in isset() returning TRUE, causing the conditions within your IF statement to parse.

In your scenario above, you were checking that the element key, name, in the $_POST super global variable was set (i.e. PHP had loaded the contents of the HTTP POST data into $_POST for you to manipulate). It is important that you perform checks to ensure variables are set before trying to manipulate them (using isset()) to prevent notices and bugs from cropping up within your application.

thanks alot for this information.