dmacman Posted April 18, 2006 Share Posted April 18, 2006 Hi All,I am trying to do several forms with dynamic radio buttons ( I would use checkboxes, but I want to limit them to only one selection per item).I can build the form dynamically and get the data, but I want to retain the position of the radio button in an array (to insert into my table).IE...|---Radio Button 1-|-Radio Button 2--|-Radio Button 3--||-----------------------|-----Selected--------|--------------------| [Radio Button] => Array ( [0] => 0 [1] => 1 [2] => 0 )Again, If I could limit the users selection to one checkbox, I would just to pull off this positioning in the array I am trying to achieve.Is this even possible?Thanks,Don Quote Link to comment Share on other sites More sharing options...
Barand Posted April 18, 2006 Share Posted April 18, 2006 Don't understand your problem.Are you having a problem when creating the form and showing the correct button as selected? Quote Link to comment Share on other sites More sharing options...
dmacman Posted April 19, 2006 Author Share Posted April 19, 2006 Hi Barand,The problem I have is I am making a list of 45 celebrities and creating the 'poll' dynamically. I setup the choices as radio buttons so they can only vote for 1 category. But my table is setup with a different field for each category ( I now know this is not efficient and I am working on an enum field to store the votes).I could have used checkboxes, but without a javascript snippet, they could chose all the categories (and the checkbox method would make the array easy to store in my current table layout).What I was trying to do is save the position (of chosen category) and store it in that field along with a 'zero' for the non-chosen categories.I don't know i that is even possible, but would like to know, just for knowledge sake.Does that make more sense?Thanks,Don Quote Link to comment Share on other sites More sharing options...
poirot Posted April 19, 2006 Share Posted April 19, 2006 Okay, I think I understood. Simple give the radio groups different names:[code]<input type="radio" name="group1" value="value1"> Value 1 for Group 1<input type="radio" name="group1" value="value2"> Value 2 for Group 1<input type="radio" name="group1" value="value3"> Value 3 for Group 1<input type="radio" name="group2" value="value1"> Value 1 for Group 2<input type="radio" name="group2" value="value2"> Value 2 for Group 2<input type="radio" name="group2" value="value3"> Value 3 for Group 2[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.