bonjour
je souhaite effacer une ligne dans un tableau ci joint le code
quand je clic sur le bouton supprimer j'efface la derniere ligne et non la ligne choisie
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 <? session_start(); $ARRAY = $_SESSION['tableau'] ; if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) { $i = $_POST['i']; array_splice($_SESSION['tableau'], $i, 1); } ?> <html> <head> <title>Document sans titre</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <? $heigh=sizeof($ARRAY); $width=sizeof($ARRAY[0]); ?> <form name="form1" method="post" action="ov2_lire_fichier_csv_tableau_2.php"> <TABLE width="167" align="center"> <? for($i=0;$i<$heigh;$i++) { ?> <TR> <TD><? echo $i ?> <? echo $width ?></TD> </TR> <TR> <? for($j=0;$j<$width;$j++) { ?> <TD width="122"> <input name="textfield" type="text" value=" <? echo htmlspecialchars($ARRAY[$i][$j], ENT_QUOTES); ?>"> </TD> <? } ?> </TR> <TR> <TD><p> <input type="submit" name="Submit" value="EFFACER"> <input type="hidden" name="MM_insert" value="form1"> <input type="hidden" name="i" value="<?php echo $i; ?>"> </p> </TD> </TR> <? } ?> </TABLE> </form> </body> </html>
avez vous une idée ou j ai fais la faute ? avec la fonction array_splice a moins que vous connaisiez une autre facon de supprimer cette ligne
merci a tous
Partager