I have a textarea. After the click on the "submit" the date from the textarea should be send from row to row to a database. But first i want to replace the german special letters (ä,ö,ü,ß).
My problem: It doesn't work. The output is always "ä, ö or ü". But if I replace the variable with a static "ä" (and don't use the data from the textarea), the script is working. If I use the data from the textarea after the explode, the script does not replace the letters.
<form action="kategorie-add.php" method="POST">
<textarea name="kategorien"></textarea><br>
KAT-NR: <input type="text" name="genre"><br>
<input type="submit" name="submit" value="Senden">
</form>
<?php
if($_POST['submit']){
$msg = explode( "\r\n", $_POST['kategorien'] );
foreach( $msg as $zeile ){
$ers = array(
'Ä' => 'Ae',
'Ö' => 'Oe',
'Ü' => 'Ue',
'ä' => 'ae',
'ö' => 'oe',
'ü' => 'ue',
'ß' => 'ss'
);
$PfadDoc = strtr($zeile,$ers);
//This is working:
//$PfadDoc = strtr('ä',$ers);
echo $PfadDoc
?>