So this is the piece of code causing a problem. It gives me a fatal error and says that an optional value is giving nil.
How do i fix this? This only works when I enter the first field only (the name field) and then submit, it pops up on my database. However, when I fill in more than one field, it crashes.
My code:
@IBAction func registerButtonTapped(sender: AnyObject) {
let strURL: String = "http://www.blabla.com.eg/blabla.php?name=\(nameField.text!)&company=\(companyField.text!)&email=\(emailField.text!)&phonenumber=\(phoneNumberField.text!)"
let dataURL: NSData = NSData(contentsOfURL: NSURL(string: strURL)!)!
let strResult: String = String(data: dataURL, encoding: NSUTF8StringEncoding)!
print("\(strResult)")
self.dismissViewControllerAnimated(true, completion: nil)
}