Esatto, perché ti ripeto, secondo me il problema ce l'hai con HTML/JS, non con PHP.