Re: [SMARTY] counting
| From: | Monte Ohrt | Date: | Fri, 12 Jul 2002 03:25:24 +0000 |
| Subject: | Re: [SMARTY] counting | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5258@lists.php.net to get a copy of this message | ||
Your better off using an array.
<input type="checkbox" name="checkboxids[]" value="checkbox">
Then after the form is submitted, $checkboxids will be an array of the selected values.
Blue Presley wrote:
hello. I am using {section} to loop through mysql results and display them as rows in a table. I have a check box in the far right column of each dynamically generated row so that people can select which rows they would like to delete. in order to properly delete the checked item, I need to individualize the checkbox names. I currently have it set up like this: {section name=searchresults loop=$ids} <tr> <td><input type="checkbox" name="checkbox{$ids|count}" value="checkbox"></td> <td height="30">{$ids[searchresults].postdate}</td> <td ><a href="jobdetails.php?ID={$ids[searchresults].adid}">{$ids[searchresults].adt itle}</a></td> <td >{$ids[searchresults].location}</td> <td >{$ids[searchresults].companyname}</td> </tr> {/section} please notice the {ids|count}. I was hoping this would generate a new number for each loop and, voila, a different name for each checkbox. of course the numbering should correspond to the number of elements in the $ids array. I'm not getting the results i want. I guess I'm confused as to how the count property works so how do I do it to make it count and give each checkbox it's on name? (checkbox1, checkbox2, etc) thanks blue