목적-C와 PHP에서 POST 방법 목표를-C내가 통해 다음과 같은 POST 방법 만든
-(IBAction) postLocation: (id) sender{
NSString *latitude = @"37.3229978";
NSString *longitude = @"-122.0321823";
NSMutableURLRequest *request =[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://www.mydomain.me/webservice.php"]];
[request setHTTPMethod:@"POST"];
NSString *post =[[NSString alloc] initWithFormat:@"latitude=%@longitude=%@submit",latitude,longitude];
[request setHTTPBody:[post dataUsingEncoding:NSUTF8StringEncoding]];
NSURLResponse *response;
NSError *err;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
}
내 PHP 코드는 다음과 같습니다
if (isset($_POST['submit']){
//it doesn't get into this if statement
$latitude = $_POST['latitude'];
$longitude = $_POST['longitude'];
}
질문은, 왜 수 없습니다 PHP 코드가 if 문에 들어가는가? 객관적인 C를 통해 '제출'을 어디에서 확인할 수 있습니까?
나는 대답을 찾았습니까? 나는이 정확한 문제를 겪고있다 : http://stackoverflow.com/questions/13110180/php-get-value-erased-when-placed-in-ifisset – Celeste