I have user input which in this case will be Hello
$command = mysqli_real_escape_string($con,$_POST['command']);
a variable called $dialogue_unlock is populated through some scripts. Which for testing will output 'Hello','Goodbye'
$dialogue_unlock .= ',\''. $discuss_row['discussion_text'].'\'';
Im then trying to see if the user input matches the array
$dialogue_array = array($dialogue_unlock);
if(!in_array("$command", $dialogue_array)){
$err .= 'Invalid Question';
}
As a test im using
echo $err. '<br>';
echo $command. '<br>';
echo $dialogue_unlock;
I get
Invalid Question
Hello
'Hello','Goodbye'
I just cant wrap my head around it as 'hello' is definitely in 'Hello','Goodbye'. Can anybody offer some advise please.
Many thanks.
$dialogue_array = explode(",", $dialogue_unlock);