passing random variables names
| From: | Yonatan Ben-Nes | Date: | Fri, 07 Nov 2003 08:40:38 +0000 |
| Subject: | passing random variables names | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-168805@lists.php.net to get a copy of this message | ||
Hi all,
I made a form which pass constant variables which never change (Ex. product_name) and dynamic
variables which i withdraw from the db (Ex. attribute_id = 1, value = color).
Now my problem is with the passing of the dynamic variables.
Because the fields can change their name (id's) i need to design my functions so they will
"know" how to receive them.
I used to make an array in the form (Ex. attribute_id[0], attribute_id[1] where the numbers in the
[] are the id numbers from the db) and then at the function i used to
$_POST['attribute_id'] and then withdraw from them their id's and values.
I read that this kind of passing variables is making problems with javascripting (and maybe it
violate W3C standards).
Is there a way that i can pass names like attribute_id_X where X is the changing name and the
function will be able to withdraw it like $_POST['attribute_id_X'], or any other way which
doesnt violate W3C standards?
Any help will be greatly appreciated,
Thanks
------------------------------------------------------
"My friends are worth gold to me, so I prefer to sell them and get rich!"
Ben-Nes Yonatan
Canaan Surfing Ltd
Tel: 972-4-6991122
Fax: 972-4-6990098
http://www.canaan.net.il
------------------------------------------------------