I am getting this error:
Parse error: syntax error, unexpected T_SL on line 23
Here is line 23:
$selectorder =
It's called "Heredoc syntax", and it lets you specify large strings without using quotes. In this case, it looks like you're using it to put JavaScript code into a variable. Since you started the string with <<ORDER;, as you have — but you need to make sure that ORDER; occurs at the start of a line, with no whitespace before it.