I still get the problem of $Terms being assigned the value of array_rand. It is like the array_rand function does not have time to run, before the actual <?php script runs as a whole. Is there anyway to tell php to, Run this code first, then continue on with running the rest of the code.

The trouble is that, per the documentation, array_rand() returns the key(s) for the random element(s) chosen, not the value of the element. To retrieve the value, use the key just like any array key. Also, you're telling it to return 5 keys, but I'm assuming that you only want one, not all of them, and since the function defaults to returning just one, you can skip the second argument. So this is probably more like what you want