got it working with these changes
Php changes:-
$data1=mysqli_escape_string($conn,$_POST['data1']);
$name=mysqli_escape_string($conn,$_POST['name']);
$project=mysqli_escape_string($conn,$_POST['project']);
C++ code changes:-
string data1 = "data1="+name+"&name="+n+"&project="+k;
curl_easy_setopt(curl, CURLOPT_POSTFIELDS,data1.c_str());