I am making a form that should generate a javascript alert when some fields are not populated or populated properly. I want to be able to receive error messages that I entered in a php variable and display them in a javascript warning window.
The following code does not work:
function died($error) {
echo '<script type="text/javascript"> alert('.$error.')</script>';
die();
}
How to add the line contained in $errorbetween two lines of a "script" so that it correctly displays as a javascript warning?
Thank!
source
share