counting

From: Date: Fri, 12 Jul 2002 02:11:53 +0000
Subject: counting
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5257@lists.php.net to get a copy of this message
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

« previous php.smarty.general (#5257) next »