alright -- please stop posting your entire project. instead, make a post asking how to do what you want to do (with details); it's a lot more convenient for anyone trying to help you.
either way, I saw what you were trying to do in sub1.php:
this is something that you can never do. you can't assign a PHP variable to a JavaScript value -- period. there has to be some sort of interaction between the client and the server for PHP to get involved. this could be by submitting a form, or this could be by using AJAX. what you're trying to do, however, is not possible.