If you are struggling to write reusable pages in apex 4.1 with even simple things such as creating dynamic title page try this
1. Stores title in hid field.
2. In title text put &PX_XX. where the name matches the field in point 1
Seems a mishmash on what you should declare to use the value of a field e.g :PX_XX or P_XX or sometimes v('') but you can get reusable code done in apex to a certain extent. As long as u don't expect MVC levels :)
Padding parameters by URL is also a bit unusual. You have to list the parameters you are populating on the next page then separate this with a : and then the values u are inputing
E.g url = 'f?p=&APP_ID.:4:&APP_SESSION.::&DEBUG.::P4_ID,P4_TRANSACTION:&P15_ID.,EDIT'