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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Building array element names

Status
Not open for further replies.

awingnut

Programmer
Joined
Feb 24, 2003
Messages
759
Location
US
I have a built set of radio button INPUT tags in which the name of each set had a number appended to it (button1, button2, etc.). Now I want to loop through the buttons and get the value for each. What is the syntax for building the names? Here is what I tried that doesn't work:
Code:
$button_value=$_POST['button$i'];
I guess the $i is recognized in double quotes but not single quotes.
 
I guess I thought the single quotes were required for the array syntax. It works, thanks.
 
In terms of use of strings, PHP does not differentiate between single-quoted string literals and double-quoted string literals.

It is only in how the string literals actually compose the actual string that it matters at all.

Want the best answers? Ask the best questions: TANSTAAFL!
 
If for the regular variable, you can use this: ${"button$i"}

--
Mike FN
"8 out of 10 Owners who Expressed a Preference said Their Cats Preferred Web Programmer."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top