title: UITextField post via PHP to MySQL
body: <p>I'm trying to post these 4 text-fields through a php-form and then insert it in my database.</p>
  
  <pre><code>IBOutlet UITextField *who;
      IBOutlet UITextField *what;
      IBOutlet UITextField *where;
      IBOutlet UITextField *contact;
  </code></pre>
  
  <p>And the post method in Xcode is:</p>
  
  <pre><code>- (IBAction)post:(id)sender
  {
      NSLog(@"%@", who);
      NSLog(@"%@", what);
      NSLog(@"%@", where);
      NSLog(@"%@", contact);
      // create string contains url address for php file, the file name is post.php, it receives parameter :name
      NSString *strURL = [NSString stringWithFormat:@"http://website.com/post.php?who=%@&amp;what=%@&amp;where=%@&amp;contact=%@",who, what, where, contact];
  
      // to execute php code
      NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]];
  
      // to receive the returend value
      NSString *strResult = [[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding];
  
      NSLog(@"%@", strResult);
  }
  </code></pre>
  
  <p>My post.php file looks like this:</p>
  
  <pre><code>&lt;?php header("Location: feed.php"); ?&gt;
  &lt;?php 
  
  define ( 'DB_NAME','database_name');
  define ( 'DB_USER','user');
  define ( 'DB_PASSWORD','root');
  define ( 'DB_HOST','localhost');
  
  $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
  
  if (!link) {
  die('Could not connect: ' .mysql_error());
  }
  
  $db_selected = mysql_select_db(DB_NAME, $link);
  
  if (!$db_selected) {
  die('Can\'t use ' . DB_NAME . ': ' . mysql_error());
  }
  
  $value1 = $_REQUEST['who'];
  $value2 = $_REQUEST['what'];
  $value3 = $_REQUEST['where'];
  $value4 = $_REQUEST['contact'];
  
  $sql = mysql_query("INSERT INTO content VALUES ('','".mysql_real_escape_string($value1)."','".mysql_real_escape_string($value2)."', '".mysql_real_escape_string($value3)."','".mysql_real_escape_string($value4)."')") or die(mysql_error());
  
  
   if (!mysql_query($sql)) {
  die('Error: ' . mysql_error());
  }
      echo "You've just posted your text!";
  mysql_close();
  ?&gt;
  </code></pre>
  
  <p>But when I try to post from the app, nothing happens...</p>