trying to send variables entered in text fields to a php script to write into an sql database. attempting to use HTTP request
@IBAction func submit(_ sender: AnyObject) {
let requestURL = NSURL(string: "***************")
let request = NSMutableURLRequest(url: requestURL! as URL)
request.httpMethod = "POST"
let song=txt1.text!
let artist=txt2.text!
let album=txt3.text!
let year=txt4.text!
let genre=txt5.text!
let songPost = "song=" + (song as String)
let artistPost = "&artist=" + (artist as String)
let albumPost = "&album=" + (album as String)
let yearPost = "&year=" + (year as String)
let genrePost = "&genre=" + (genre as String)
request.httpBody = songPost.data(using: String.Encoding.utf8);
request.httpBody = artistPost.data(using: String.Encoding.utf8);
request.httpBody = albumPost.data(using: String.Encoding.utf8);
request.httpBody = yearPost.data(using: String.Encoding.utf8);
request.httpBody = genrePost.data(using: String.Encoding.utf8);
NSURLConnection.sendAsynchronousRequest(request as URLRequest, queue: OperationQueue.mainQueue)
I get an error on the bottom line of code reading: Missing argument for parameter 'completion hander' in call.
not sure what this means.