I am trying to send data from a form to a php file so I can store it in a database, but its not working...
The code for the form is not on the same server as the php
Add this at the beginning of your PHP file:
header("access-control-allow-origin: *");
More info on cross domain policy here.