Corrected problem with docMan_id. In old schema it was numeric so it was set to zero. In new schema it is a VARCHAR. Changed the test to isset($docMan_id) but that will be true even if it is a zero. So added a test to make sure it is not zero.