I stumbled on this question as I had the same error. Mine was due to a slightly different problem and since I resolved it on my own I thought it useful to share here. Original code with issue:
$comment = "$_POST['comment']";
Because of the enclosing double-quotes, the index is not dereferenced properly leading to the assignment error. In my case I chose to fix it like this:
$comment = "$_POST[comment]";
but dropping either pair of quotes works; it's a matter of style I suppose :)