Hello.
I’ve got a slugify word function :
static public function slugify($text)
{
$text = str_replace(" ", "_", $text);
$text = str_replace(",", "", $text);
$text = str_replace(".", "", $text);
// replace non letter or digits by -
$text = preg_replace('~[^\\\\pL\\d_]+~u', '-', $text);
// trim
$text = trim($text, '-');
// transliterate
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
// lowercase
$text = strtolower($text);
// remove unwanted characters
$text = preg_replace('~[^-\\w]+~', '', $text);
if (empty($text))
{
return 'n-a';
}
return $text;
}
my question is , if possible is to slugify a word typed in html input (text) and then update a form with a converted word? of course all the action after pressing buttong “submit”.
e.g.
We’ve got a word : Ri ch, a.r.d,
After a function its converted to a Richard
Converting is pretty easy , but it’s possible to update a html input with php?
I know that JQuery provide this issue , but I would like to do it in PHP.