Jump to content

in_array error


Recommended Posts

{
  	$required = array ('newname' , 'newpass' , 'verpass' , 'email' , 'veremail' , 'country'); //LIST OF FIELDS NOT REQUIRED
}
case "new":
	foreach($_POST as $field => $value)
	{
   if (in_array($field, $required))  //LINE 79
		{
        if ($value == "")
        {
			unset($_GET['do']);
			$message_new = "A Required field entry is missing. Please try again. The Missing Field is $field";
      include("login_form.html");
			exit();
		}
	}

ERROR!

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/.mccoy/wamboldt/ictonentertainment.com/wamboldt/login.php on line 79

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/.mccoy/wamboldt/ictonentertainment.com/wamboldt/login.php on line 79

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/.mccoy/wamboldt/ictonentertainment.com/wamboldt/login.php on line 79

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/.mccoy/wamboldt/ictonentertainment.com/wamboldt/login.php on line 79

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/.mccoy/wamboldt/ictonentertainment.com/wamboldt/login.php on line 79

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/.mccoy/wamboldt/ictonentertainment.com/wamboldt/login.php on line 79

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/.mccoy/wamboldt/ictonentertainment.com/wamboldt/login.php on line 79

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/.mccoy/wamboldt/ictonentertainment.com/wamboldt/login.php on line 79

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/.mccoy/wamboldt/ictonentertainment.com/wamboldt/login.php on line 79

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/.mccoy/wamboldt/ictonentertainment.com/wamboldt/login.php on line 79

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/.mccoy/wamboldt/ictonentertainment.com/wamboldt/login.php on line 79

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/.mccoy/wamboldt/ictonentertainment.com/wamboldt/login.php on line 79

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/.mccoy/wamboldt/ictonentertainment.com/wamboldt/login.php on line 79

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/.mccoy/wamboldt/ictonentertainment.com/wamboldt/login.php on line 79

i put a comment on line 79. That is the right datatype so what is wrong?

Link to comment
https://forums.phpfreaks.com/topic/41130-in_array-error/
Share on other sites

I see that you are defining $required as an array inside a block:

{
  	$required = array ('newname' , 'newpass' , 'verpass' , 'email' , 'veremail' , 'country'); //LIST OF FIELDS NOT REQUIRED
}

 

Is that an "if"? Because if it is, it's probably not entering the block (this condition is false) and that's why $required is not being defined.

 

You need to either make sure that if gets executed all the time, or define $required within the "new" case (or before of it- whats important is that it will be defined).

 

Orio.

Link to comment
https://forums.phpfreaks.com/topic/41130-in_array-error/#findComment-199230
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.