If you are using P1 as a shadow register, then you should not be updating it with the PRT1DR value. You should only write values that you need to reflect on your output pins and then update the PRT1DR with P1 value.
Check out the below Blog article that explains the concept of shadow register.
Best Regards, Ganesh
"Analog hi Z" is not the correct drive state for digital inputs. In order to be digital inputs, they need to be configured as "hi Z". "analog hi Z" drive turns off the digital input schmitt trigger.
Thank you both for the responses. Problem solved.