This error is probably comming from this:
$user_id=mysql_real_escape_string($_POST['user_id']);
If so, the $_POST array probably does not contain an element with the key user_id
. The reeasons could be:
you either have not checked the user ID checkbox. Solution: check for existence of the element in post:
if(isset($_POST['user_id'])) {
// if user ID exists, asign it to the variable
$user_id=mysql_real_escape_string($_POST['user_id']);
} else {
// otherwise do whatever is appropriate
echo 'User ID is missing';
}
or the user ID checkbox might have other name than user_id
. Chek the script that contains the form.
It is actually a good idea to check for existence of all the $_POST array elements before using them.