php - array element removed twice -


i have problem delete element in array. every time pass delete procedure, array has reduced something. don't know in line element removed. please me check sample code.

<?php if ($_request['act'] == 'add') {   // add procedure }  if ($_request['act'] == 'del') {   // del procedure   array_splice($_session['items'], $_get['id'], 1); } ?>  <table>   <tr>     <td>no.</td>     <td>content</td>     <td>del?</td>   </tr>   <?php   $j = count($_session['items']);    for($i = 0; $i < $j; $i++) {   ?>   <tr>    <td><?php echo $i + 1; ?>    <td><?php echo $_session['items'][$i]; ?>    <td><a href=<?php echo $_server['php_self']; ?>?act=del&id=<?php echo $i; ?>>del</a>   </tr>   <?php   }   ?> </table> ?> 

i have write mark inside del procedure check if condition passed twice, it's echo once.

fyi, not real code. code has multi dimension array. think code reflect real condition.

thanks before.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -