The issue is that you use php://input. That is only to use form the command line. In your case use $_POST['testvalue'] Don't forget to escape the content of $_POST['testvalue'] with mysql_espace_string