Problem using NSURLRequest to POST data to server

You should remove the leading & in myRequestString and the problem is likely that the correct content-type header is not being sent. Try adding a call to

[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];

You should also not pass nil for error, so you can see what the client thinks is going on.

Unrelated, but your PHP code is open to SQL injection attacks.


It should be noted that ...

NSData *data = [NSData dataWithBytes: [myRequestString UTF8String]
                              length: [myRequestString length]];

... is very bad and can cause vague errors. With UTF8 there is zero guarantee that the number of bytes in your encoded string is the same as the number of characters in your string.

So instead, you should simply use:

NSData *data = [myRequestString dataUsingEncoding: NSUTF8StringEncoding];