I am learning how to write iOS apps and am learning Objective-C. I'm trying to take a form that has 7 fields and POST it to my webserver. I already have the code that does the POSTing, I just need to concatenate all the text input fields into one NSString
The text input fields are named in the .h
file as follows:
ctName
ctAddress1
ctAddress2
ctCity
ctState
ctZIP
ctPhone
Any help would be greatly apprectiated.
UPDATE
So I've figured it out, but I can't answer my own question for a couple of hours... Here's what I came up with. It may not be the most efficient way of doing it, but I've tested it and it works.
NSString *body = [NSString stringWithFormat:@"stripeToken=%@", token.tokenId];
body = [body stringByAppendingString:@"&ctname="];
body = [body stringByAppendingString:self.ctName.text];
body = [body stringByAppendingString:@"&ctadd1="];
body = [body stringByAppendingString:self.ctAddress1.text];
body = [body stringByAppendingString:@"&ctadd2="];
body = [body stringByAppendingString:self.ctAddress2.text];
body = [body stringByAppendingString:@"&ctcity="];
body = [body stringByAppendingString:self.ctCity.text];
body = [body stringByAppendingString:@"&ctstate="];
body = [body stringByAppendingString:self.ctState.text];
body = [body stringByAppendingString:@"&ctzip="];
body = [body stringByAppendingString:self.ctZIP.text];
body = [body stringByAppendingString:@"&ctphone="];
body = [body stringByAppendingString:self.ctPhone.text];