1
<?php
$string = $_POST["nome1"];
function removeAcentos($string, $slug = false){
$string = strtolower($string);
$ascii['a'] = range(224, 230);
$ascii['e'] = range(232, 235);
$ascii['i'] = range(236, 239);
$ascii['o'] = array_merge(range(242, 246), array (240, 248));
$ascii['u'] = range(249, 252);
$ascii['b'] = array(223);
$ascii['c'] = array(231);
$ascii['d'] = array(208);
$ascii['n'] = array(241);
$ascii['y'] = array(253, 255);
foreach ($ascii as $key=>$item) {
$acentos = '';
foreach ($item as $codigo) $acentos .= chr($codigo);
$troca[$key] = '/['.$acentos.']/i';
}
$string = preg_replace(array_values($troca), array_keys($troca), $string);
return $string;
}
?>
<html>
<body>
<form action="" method="post">
Nome:
<input type="text" name="nome1">
<br>
<input type="hidden" name="nome2" value='$string'>
<br>
<input type="submit" value="OK">
</form>
Nome:
<?php echo $_POST["nome1"]; ?><br>
Nome trocado:
<?php echo removeAcentos($_POST['nome1']; ?>
</body>
</html>
try this way https://answall.com/a/33035/8939 with this feature, you may remove accent at all
– flourigh