counter function in hidden value name??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ganza
Forum Newbie
Posts: 19
Joined: Fri Nov 07, 2008 3:56 am

counter function in hidden value name??

Post by ganza »

Code: Select all

 
         foreach($list as $record)
    {
        echo "<tr>\r\n";
        echo "  <td>".$record['personIncharge']."\r\n";
        echo "  <input type='submit' name='EditPIC' value='edit'></td>\r\n";
        echo "  <input type='hidden' value=".$record['contact_ID']." name="uiuaa">\r\n";
        echo "  <td>".$record['designation']."</td>\r\n";
        echo "  <td>".$record['department']."</td>\r\n";
        echo "  <td>".$record['mainLine']."</td>\r\n";
        echo "  <td>".$record['faxLine']."</td>\r\n";
        echo "  <td>".$record['directLine']."</td>\r\n";
        echo "  <td>".$record['mobile']."</td>\r\n";
        echo "  <td><a href='deleteRow.php?id=".$record["contact_ID"]."'>Delete</a></td>\r\n";
        echo "</tr>\r\n"; 
    }
    echo "</table>\r\n";
}
 
is it possible for me to add a counter command in hidden value name?
so i mean it will give different name each line (0001uiuaa)
the second line will be (0002uiuaa) etc ...
is it possible?
watson516
Forum Contributor
Posts: 198
Joined: Mon Mar 20, 2006 9:19 pm
Location: Hamilton, Ontario

Re: counter function in hidden value name??

Post by watson516 »

Code: Select all

 
$count=1;
         foreach($list as $record)
    {
        echo "<tr>\r\n";
        echo "  <td>".$record['personIncharge']."\r\n";
        echo "  <input type='submit' name='EditPIC' value='edit'></td>\r\n";
        echo "  <input type='hidden' value=".$record['contact_ID']." name='".$count."uiuaa'>\r\n";
        echo "  <td>".$record['designation']."</td>\r\n";
        echo "  <td>".$record['department']."</td>\r\n";
        echo "  <td>".$record['mainLine']."</td>\r\n";
        echo "  <td>".$record['faxLine']."</td>\r\n";
        echo "  <td>".$record['directLine']."</td>\r\n";
        echo "  <td>".$record['mobile']."</td>\r\n";
        echo "  <td><a href='deleteRow.php?id=".$record["contact_ID"]."'>Delete</a></td>\r\n";
        echo "</tr>\r\n"; 
        $count++;
    }
    echo "</table>\r\n";
}
 
Something like that I would think no?
Post Reply