You can not run PHP within a PhoneGap app. Thus this code will not work.
should i put the php file on my website root and refer to it there? but that will be connecting outside of phonegap, then this will work. if it does planning on validation, first making it run simply.
You can call your PHP remotely without a problem Use standard AJAX/REST calls and you will be good to go
Just make sure you allow for external communication with your server in the config.xml file