I am using php to update some myqsl values from an html form and after the update i want to redirect the user to the page where he/she clicked 'update'. In order to accomplish that i am using the following line
echo "<script>var prevUrl='<?php echo $_SERVER['HTTP_REFERER'];?>';alert('Updated movie $mv !'); window.location.href=prevUrl;</script>";
but i get the following error
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in
I tried using \ as escape character for the ' in HTTP_REFERER but i had no luck. I tried writing the var with single and double quotes but still no luck.
Any suggestions?