My database is giving me week days as "0", "1", "3", "4", "5", "6". And I wanted to translate it to their actual name.
So I'm doing:
HMTL
<div><script>traduzir("<?php echo $row_room['weekday']?>")</script></div>
JS
<script>
function traduzir (woord){
if (woord == "0")
{
return "Domingo";
}
if (word == "1")
{
return "Segunda";
}
if (word == "2")
{
return "Terça";
}
if (word == "3")
{
return "Quarta";
}
if (word == "4")
{
return "Quinta";
}
if (word == "5")
{
return "Sexta";
}
if (word == "6")
{
return "Sabado";
}
};
</script>
I'm getting "traduzir is not defined" error. Can someone help? Thanks!
traduziris defined in the html before it is called.