I need to print an error which contain html format which in my case is <strong>
. here's my code that i want to produce the output
if (empty($namabelakang)){
$errors[] = "<strong>Nama Belakang</strong> tidak boleh kosong";
}
and here's the one which i use to print:
foreach($errors as $error){
echo clean($error)."<br>";
}
It's not print as i'm expecting, it print
<strong>Nama Belakang</strong> tidak boleh kosong
Rather than:
Nama Belakang tidak boleh kosong
Please help me how can I fix it? here's the code for clean function:
function clean($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
function clean($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
$data = str_replace(array("<strong>", "</strong>"), array("<strong>", "</strong>"), $data);
return $data;
}