I know we can have same psn account on ps3 and ps4 but after transfering to ps4 can I still play my ps3 games online?
It's probably best to not think about it as "transferring" your account, and see it as simply signing into your PSN account on your PS4. You can still log into your PS3 with it, and even a Vita if you have one.
The question then comes down to "can I play my PS3 games on my PS4". The answer is no, as the PS4 is not backwards compatible.
But this doesn't mean you can't just simply sign in on your PS3 and play your games there.