I am pretty close to achieving what you have supplied, but upon testing I get this error after creating the two insert records for the main and sub category submit buttons:
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in D:\hosting\9062558\html\v2\admin\category_manage.php on line 93
Figured out that at some points I chose PowerCMSConnection for the database connection and other times I chose my saved RemoteConnection for the connection. I had to include both connection files in the php page. It's working now!!