POST variables are passed via the super global array $_POST
in PHP. So in your case, this would technically work:
$params = array(
'name' => $_POST['fname'],
'email' => $_POST['email'],
'ad_tracking' => 'test',
'ip_address' => $_SERVER['REMOTE_ADDR'],
);
Your code for $_SERVER["REMOTE_ADDR"]
was enclosed in single quotes, which in PHP means a verbatim string (i.e. without variable interpolation).
Btw, you should think of input filtering too - http://www.php.net/filter
To give you an example, this would perform input filtering in your current case:
$filtered = filter_input_array(INPUT_POST, array(
'fname' => FILTER_SANITIZE_STRING,
'email' => FILTER_VALIDATE_EMAIL,
);
Each value inside $filtered
will either have a value (valid), be NULL
(not present) or false
(invalid).