Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GET array variables

Status
Not open for further replies.

BiggerBrother

Technical User
Sep 9, 2003
702
0
0
GB
I am posting to a form using the GET method.

The problem is that I need to be able to distinguish between item[101]=2 and item=2. Is there a way distinguish where the variable is an array element, or using pairs, is there a way to to reutn true if pairs exist, or false if they are missing?

Many thanks for any advice

BB
 
More exactly, you're posting these values to a script. A form is an HTML construct that allows a user to input and manipulate the values that will eventually be submitted to a form.


I'm sorry, but I still don't understand what you're asking. You cannot have an HTML form with an element named "item" and an element named "item[101]" both in it. You will not be able to access the value from "item".

However, you can have multiple elements named "item[]" or elements named of the form "item[1]", "item[2]", etc. In such cases, $_GET['item'] will itself be an array, accessible as $_GET['item'][0], $_GET['item'][1], etc.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top