I have a form submit in which if an error occurs then i want the border of the text element to be red.
if(isset($_POST["forgotsubmit"])){
if(!empty($_POST["forgotemail"])){
else{
echo "<script>document.getElementById('forgotemaill').style.border= 'border: 2px solid red';</script>";
}
}
}
Now after this in console shows
forgot-password:61 Uncaught TypeError: Cannot read property 'style' of null
at forgot-password:61
(anonymous) @ forgot-password:61