Can’t you just do this, just add array(…) to it? Like this:
$posts_for_plugin = array(1,324,34);
I don’t know for sure though, I don’t know a whole lot about PHP.
Also, how exactly are they set from the dashboard? Perhaps you can make it so that it will be inserted in an array immediately?