i got error message if sent empty post in my registration form
Notice: Undefined index: terms in /opt/lampp/htdocs/user/register.php on line 34
in the line 34 i have this
$terms = trim($_POST["terms"]);
and in the form i have this
<p>
<input type="checkbox" name="terms" id="terms"> I have read and accept the conditions of use
</p>
and this is all the validation form
if(!empty($_POST))
{
$errors = array();
$terms = trim($_POST["terms"]);
$captcha = md5($_POST["captcha"]);
$name = trim($_POST["name"]);
if($terms == "")
{
$errors[] = lang("ACCOUNT_SPECIFY_NAME");
}
//End data validation
if(count($errors) == 0)
{
//Construct a user object
$user = new User($username,$password,$email,$name,$lastname);
//Checking this flag tells us whether there were any errors such as possible data duplication occured
if(!$user->status)
{
if($user->username_taken) $errors[] = lang("ACCOUNT_USERNAME_IN_USE",array($username));
if($user->email_taken) $errors[] = lang("ACCOUNT_EMAIL_IN_USE",array($email));
if($user->email_blocked) $errors[] = lang("ACCOUNT_EMAIL_BLOCKED");
}
else
{
//Attempt to add the user to the database, carry out finishing tasks like emailing the user (if required)
if(!$user->userCakeAddUser())
{
if($user->mail_failure) $errors[] = lang("MAIL_ERROR");
if($user->sql_failure) $errors[] = lang("SQL_ERROR");
}
}
}
}
?>
why i got this alert message?
thanks
Try to replace this:
if(!empty($_POST))with this:
if(!empty($_POST["terms"]))You need to make sure that array $_POST has a value with key terms
EDIT:
Try this:
instead of this: