is there a way to do this

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jaymoore_299
Forum Contributor
Posts: 128
Joined: Wed May 11, 2005 6:40 pm
Contact:

is there a way to do this

Post by jaymoore_299 »

Given a set of radio buttons with names radio1 , radio2 , radio 3 , ....
I want to be able to do this:

Code: Select all

$number=1;
print "$_POST['radio".$number."']";
so that by changing the $number variable I can access any of the radio button
but this does not work, I tried escaping the characters, using variable variables, but this doesn't seem to work either.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

$_POST['radio'.$number]
Post Reply