The problem is that PHP is trying to substitute an array variable in a string, but your index begins with the double-quote character. The only allowable tokens in a string index are a character string (T_STRING), another variable (T_VARIABLE), or a number (T_NUM_STRING).
Rewrite that line like this:
Code:
$sql = "INSERT INTO agent (office_id, os_id) VALUES ('$array[os_id]')";
PHP assumes anything within square brackets is the index to the array, since it's already parsing it from within string context.
For more information on how PHP performs variable substitution within strings, read the manual at:
http://www.php.net/types.string
Take care,
Nik
http://www.bigaction.org/