Bonjour a tous,
Ok merci. j'ai decoupe mon echo.
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| <body >
<?php
if (isset($_POST['submit'])) {
$table=$_POST;
$result = array();
foreach ($table as $key => $i){
$output=array();
$output=explode("_", $key);
if ($output[0] == 'brule') {
$result[]=$output[1];
}
}
//print_r($result);
echo '<table align="left" border = "2" cellspacing ="0" cellpadding="3" id="table">
<tr>
<td><b>Business Rule:</b></td>
<td><b>Dedicated:</b></td>
<td><input type="button" Name= "Ajouter" Value="Ajouter" onclick="go()"></td>
</tr>';
foreach ($result as $j) {
$br='brule_' . $j;
$brd='brdedicated_' . $j;
$op= '<tr>';
$op += '<input type="text" name=" ' . $br . ' " size="20" maxlength="50"';
if (isset($table[$br])){
$op += 'value=" ' . $table[$br] . ' "></td>';
}
$op += '<td><input type="checkbox" name=" ' . $brd . ' " ';
if (isset($table[$brd])){
$op +='value=" ' . $table[$brd] . ' "></td>';
}
$op += '<td><input type="button" value="Delete" onclick="go()"></td>';
$op += '</tr>';
echo $op;
unset($_POST['submit']);
/** echo '<tr>
<td><input type="text" name=" ' . $br . ' " size="20" maxlength="50" value=" ' . if (isset($table[$br])) {echo $table[$br];} . ' "></td>
<td><input type="checkbox" name=" ' . $brd . ' " value=" ' . if (isset($table[$brd])) {echo $table[$br];} . ' "></td>
<td><input type="button" value="Delete" onclick="go()"></td>
</tr>'; */
}
}
else {
?>
<form method="POST" action="func3.php">
<table align="left" border = "2" cellspacing ="0" cellpadding="3" id="table">
<tr><td><b>Business Rule:</b></td> <td><b>Dedicated:</b></td><td><input type="button" Name= "Ajouter" Value="Ajouter" onclick="go()"></td></tr>
</table>
<p><input type="submit" name="submit" value="Enter"></p>
</form>
<?php
}
?>
</body>
</html> |
ce que je veux faire c'est:
creer des lignes d'un tableau (ces lignes sont creees en JS). et ensuite re-afficher mon tableau quand l'utilisateur clique sur Enter.
Avec le code montre ci-dessus, j'obtiens le resultat suivant une fois que je valide (svp voir image attachee)
Alors que quand j'ai juste mon formulaire comme cela:
1 2 3 4 5 6 7 8 9 10 11
| <body >
<form method="POST" action="func3.php">
<table align="left" border = "2" cellspacing ="0" cellpadding="3" id="table">
<tr><td><b>Business Rule:</b></td> <td><b>Dedicated:</b></td><td><input type="button" Name= "Ajouter" Value="Ajouter" onclick="go()"></td></tr>
</table>
<p><input type="submit" name="submit" value="Enter"></p>
</form>
</body>
</html> |
1 2 3 4 5
|
<?php
print_r($_POST);
?> |
me renvoie bien tout ceci:
Array ( [brule_1] => kulhkjhlk [brdedicated_1] => on [brule_2] => jo6564854698 [submit] => Enter )
comment puis je faire pour afficher ces lignes que je vois dans $_POST?
Merci d'avance.
Billy
Partager