i`m having a problem doing this code to send a data to my php server can someone help me. this is my code that gives me a headache, this is my Outlets/ textfield.
@property (weak, nonatomic) IBOutlet UITextField *parentsNameTextField;
@property (weak, nonatomic) IBOutlet UITextField *professionTextField;
@property (weak, nonatomic) IBOutlet UITextField *addressTextField;
@property (weak, nonatomic) IBOutlet UITextField *contactTextField;
@property (weak, nonatomic) IBOutlet UITextField *emailAddressTextField;
@property (weak, nonatomic) IBOutlet UITextField *osTypeTextField;
and this is the Action Button
- (IBAction)registerButtonTapped:(id)sender {
NSString *post = [NSString stringWithFormat:@"&parentNameTextField=%@&professionTextField=%@",@"parentNameTextField",@"professionTextField"];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%lu", (unsigned long)[postData length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:@"http://a7c8a2a.ngrok.com/usermanagement_dummy/user/register"]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
NSURLConnection *conn = [[NSURLConnection alloc]initWithRequest:request delegate:self];
if (conn)
{
NSLog(@"Connection Success");
}
else
{
NSLog(@"Connection could not be made");
}
}
im trying my best to continue but i don
t know how to.
any help would be gladly appreciate.