56
rated 0 times
[
57]
[
1]
/ answers: 1 / hits: 84815
/ 10 Years ago, mon, april 28, 2014, 12:00:00
I'm making a form that is supposed to create a javascript alert when some fields aren't filled out or filled out properly. I want to be able to take the error messages I've put in a php variable and display them in the javascript alert window.
The following code does not work:
function died($error) {
echo '<script type=text/javascript> alert('.$error.')</script>';
die();
}
How can I add the string contained in $error
between the two script strings so it will output properly as a javascript alert?
Thank you!
More From » php