Your first block has a syntax error; you need to escape the single quote, since the string is single-quoted.
Note the syntax highlighting here:
alert('You can't remove any more services! Please contact admin if you would like your account disabled');
Escaped:
alert('You can\'t remove any more services! Please contact admin if you would like your account disabled');
However, alert
s are:
- Annoying
- A bad way to convey important information
Just add the messages as <div>
s within the page, and stylize those or pop them up with JavaScript afterwards. Accessible and less frustrating!
Also, comparing the result of isset
against something is usually wrong, and you did it twice. It seems like that should read, all told:
if (!isset($_GET['success']) || $_GET['success'] === 'no') {
echo '<script type="text/javascript">',
'alert("You can\'t remove any more services! Please contact admin if you would like your account disabled");',
'</script>';
}
else {
echo '<script type="text/javascript">',
'alert("Your details have been updated!");',
'</script>';
}
Note how I swapped the quotes there; otherwise, you'd have to escape things twice.