I have this code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Frans</title>
</head>
<body>
<form method="POST">
<textarea name="textarea" cols="16" rows="4" wrap="OFF"/>
</textarea><input type="submit" name="submit" value="submit">
</form><pre><?php
if(isset($_POST['submit'])){
if(!empty($_POST['textarea'])) {
$exp = array_filter(explode("\n", $_POST['textarea']));
print_r($exp);
// Add DB Insert here
}
$correct = array(
'Beau',
'Haut',
'Jeune',
'Gros',
'Nouveau',
'Bon',
'Long',
'Vieux',
'Mauvais',
'Autre',
'Joli',
'Petit',
'Grand',
'Large',
'Premier',
'Cher',
);
$input = $_POST['textarea'];
echo ($correct == $input) ? 'they\'re same' : 'they\'re different';
print_r($correct);
}
?>
</body>
</html>
I basicly want to check if the array is the same as the input from the textarea. This is what the input should be:
Cher Beau Haut Jeune Gros Nouveau Bon Long Vieux Mauvais Autre Joli Petit Grand Large Premier
And the output should be: They're the same. But I did something wrong because it keeps saying: "They're different" Thanks in advance.
Input was wrong excuse me. EDIT:
Beau Haut Jeune Gros Nouveau Bon Long Vieux Mauvais Autre Joli Petit Grand Large Premier Cher