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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
/*************************************************************************
************************ bibliotèque des fonctions ********************
**************************************************************************/
function afficher_liste($nomvar,$n) {
$la_liste = "<select name=$nomvar>";
for ($i=1;$i<=$n;$i++) {
$la_liste .= "<option value=$i>$i</option>";
}
$la_liste .= "</select>";
echo $la_liste;
}
function fabrique_tableau($nom_tab,$nb_ligne,$nb_colonne) {
$le_tableau = "<table cellpadding='1' cellspacing='1'>";
for ($i=1;$i<=$nb_ligne;$i++) {
$le_tableau .= "<tr>";
for ($j=1;$j<=$nb_colonne;$j++) {
$le_tableau .= "<td><input name = ".$nom_tab.$i.$j." size='5'></td>";
}
$le_tableau .= "</tr>";
}
$le_tableau .= "</table>";
echo $le_tableau;
}
/*************************************************************************
********** Saisie de la dimension des matrices ******************
**************************************************************************/
$dim_maxi = 100;
echo "<form action='index.php' method='post'>";
echo "Matrice A : NBlignes ";
afficher_liste("NbligneA",$dim_maxi);
echo " Nb colonnes ";
afficher_liste("NbcolonneA",$dim_maxi);
echo "<br>";
echo "<input type='submit' value='Creer'></form>";
/*************************************************************************
********** formulaire de remplissage des matrices ***************
**************************************************************************/
if (!empty($_POST['NbligneA']) && !empty($_POST['NbcolonneA'])) {
$ligneA = $_POST['ligneA'];
$colonneA = $_POST['colonneA'];
echo"<form action='index.php' method='post'>";
echo"********************************************************<br>";
echo"Matrice A : $NbligneA Ligne(s) par $NbcolonneA Colonne(s)<br>";
fabrique_tableau("A",$ligneA,$colonneA)."<br>";
echo"********************************************************<br>";
echo"********************************************************<br>";
echo"<input type='hidden' name = 'calcul' value=1>";
echo"<input type='hidden' name = 'ligneA' value=".$ligneA.">";
echo"<input type='hidden' name = 'colonneA' value=".$colonneA.">";
echo"<input type='submit' value='Afficher'>";
echo"</form>";
}
?>
</body>
</html> |
Partager