Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7890181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:17:18+00:00 2026-06-03T06:17:18+00:00

I am using $_POST to post data to a php file. In that php

  • 0

I am using $_POST to post data to a php file. In that php file, I have the following.

$params = array(
        'name' => "$fname",
        'email' => "$email",
        'ad_tracking' => 'test',
        'ip_address' => '$_SERVER["REMOTE_ADDR"]',
    );
    $subscribers = $list->subscribers;
    $new_subscriber = $subscribers->create($params);

What is the best way to use the $_POST data to define the vales of each keys in the array?
The use of $_SERVER["REMOTE_ADDR"] is also not working as hoped.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:17:19+00:00Added an answer on June 3, 2026 at 6:17 am

    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).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an AJAX script that post data in one of my PHP file:
passing post data using cURL requires that the name of the input. However, I
I have a Windows/Apache2/PHP app that receives file using chunked encoding. The reason is
I have a HTML/PHP form using using post to send form data to a
I have some json data existed in a php file that needs to be
I am using jQuery to post a form field to a PHP file that
I have the following form: <form id=vintro-upload-form action={url}?nexturl={nextUrl} method=post enctype=multipart/form-data > <input name=file type=file/>
I need to cause a user's browser to post data using PHP to another
I am getting data from iphone using php but when i insert post data
I have written a form using the jQuery .post() function to post the data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.