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

  • Home
  • SEARCH
  • 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 6645495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:17:40+00:00 2026-05-26T00:17:40+00:00

I want to discover whether or not a variable is set. PHP’s isset() function

  • 0

I want to discover whether or not a variable is set. PHP’s isset() function (i.e. isset($myVariable)would ordinarily provide me with the variable’s set status. However, I want to reference the variable as an expression. Is that possible? and if so, how?

A little more context and detail: I have several image submit buttons in an HTML form, each named ‘DeleteFileButtonNNN’ where NNN is an integer (actually, a file ID number). When the user clicks, say, the button associated with NNN=2, the form is submitted and $_POST[‘DeleteFileButton2_x’] gets set (whereas $_POST[‘DeleteFileButton1_x’ and $_POST[‘DeleteFileButton3_x’] will not be set). I want to be able to loop through the $_POST array in order to discover which button was clicked.

I can easily create the boundaries of the loop itself via a while or foreach loop because all possible file IDs (i.e. NNN values) are stored in a MySQL table. My need for help is in how to specify the various DeleteFileButtonNNN elements as array element indices in the $_POST array since the reference would need to be an expression (e.g. a string concatenation such as ‘DeleteFileButton’.$anInteger.’_x’). Yet I don’t believe PHP allows me to reference the $_POST array as $_POST[$someVariable].

Could someone me help please? Thank you in advance.

  • 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-05-26T00:17:41+00:00Added an answer on May 26, 2026 at 12:17 am

    PHP allows you to use anything that devolves down to an integer or a string to reference an array, so you can most definitely do:

    function x() {
       return "a";
    }
    
    $x = 'a';
    
    $val = $_POST[x()];
    $val = $_POST[$x];
    $val = $_POST['a'];
    $val = $_POST[chr(ord('a'))];
    

    “composite” keys are allowed as well:

    $_POST["someprefixstring_$x"];  // exactly the same as $_POST['someprefixstring_a'];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to discover all xml files that my ClassLoader is aware of using
I want to discover at run-time ONLY the static Methods of a class, how
I want to parse an html document after it has loaded and discover all
Want the function to sort the table by HP but if duplicate HPs then
Want to be able to provide a search interface for a collection of objects
I want to discover wrong spelling of FooBar in sentence: This is a 'FooBar'
I want to be able to discover the 10 most popular routes through our
I'm trying to discover how to change the default set of Client Spec options
Basically i want to discover if a jar implements any number of interfaces wihtout
I want to be able to discover if a Debian package has been installed

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.