|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
variable variables
ok, this ones been annoying me for a while now, I have a page which generates a list of items held by the user viewing it. This is done by looping through the query, and next to each item echoed is a checkbox, now the value of the checkbox is the same as the name of item, and the name of the checkbox is checkbox1, 2, 3 etc. going up for each item they have in their list. This form then goes to a new page, now what i need to do is echo out all the ones they selected. But because the name and value of the checkboxes which are being parsed through the form are variables, im having difficulty. Somehow i have to do a test to see which ones were parsed. Anyone have any ideas?
|
|
#2
|
|||
|
|||
|
RE: variable variables
Well, you can handle this in a couple of ways...keeping the names you have, you would have to loop through and see if the variable exists..up to a maximum amount of variables..
The other way to do it is to rename all your checkboxes into an array name...instead of calling your checkboxes checkbox1, checkbox2, and so one...make the name of all of them checkbox[]...then you can use a foreach to get the values... |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > variable variables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|