Notice: Undefined offset: PHP comment s'en débarrasser

Résolu/Fermé
gyoy Messages postés 5 Date d'inscription mardi 28 avril 2015 Statut Membre Dernière intervention 28 avril 2015 - Modifié par gyoy le 28/04/2015 à 01:46
gyoy Messages postés 5 Date d'inscription mardi 28 avril 2015 Statut Membre Dernière intervention 28 avril 2015 - 28 avril 2015 à 02:04
Salut ,je n'arrive plus à se débarrasser de ce message d'erreurs dans mon code malgré que j'ai utilisé le if(isset ... et errors reporting veuillez m'aidez s'il vous plait
A voir également:

3 réponses

jordane45 Messages postés 38145 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 25 avril 2024 4 650
28 avril 2015 à 01:46
Bonjour,

Déjà .. pourquoi as tu du code HTML dans ton fichier CLASS ?

Ensuite... il nous faut le message d'erreur exacte (et complet) pour savoir où se trouve l'erreur.

0
jordane45 Messages postés 38145 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 25 avril 2024 4 650
28 avril 2015 à 01:48
Par contre je vois une erreur sur cette ligne :
$this->M[$i][$j]=$_POST["$this->nom$i$j"];


A remplacer à mon avis par :
$this->M[$i][$j]=$_POST[$this->nom$i$j];
0
gyoy Messages postés 5 Date d'inscription mardi 28 avril 2015 Statut Membre Dernière intervention 28 avril 2015
28 avril 2015 à 01:52
je vais essayer merci
0
gyoy Messages postés 5 Date d'inscription mardi 28 avril 2015 Statut Membre Dernière intervention 28 avril 2015
Modifié par jordane45 le 28/04/2015 à 02:20
<?php
class matrice{
 private $ligne;
 private $colonne;
 private $nom;
 private $M=array();
  
  
 public function __construct()
 {
   for($i=0;$i<$this->ligne;$i++)
          {
            for($j=0;$j<$this->colonne;$j++)
            {
              $this->M[$i][$j]=0;
            }
          }
    }
    public function setname_dims($l,$c,$n){
     
     $this->ligne=$l;
  $this->colonne=$c;
  $this->nom=$n;
    }
    
    
  
 public function saisie()
 {  echo"<form method='POST' action='Classe_Matrice.php'>";
  
  echo"saisir la matrice $this->nom :::\n"; 
 
 echo"<table >";
  
   for($i=0;$i<$this->ligne;$i++)
   {
    echo "<tr>";
    
    for($j=0;$j<$this->colonne;$j++)
    { 
       echo "<td>"; 
      
       echo"<input type='text'  name=".$this->nom.$i.$j."> </td>";
     }
     echo"</tr>";}
    
             for($i=0;$i<$this->ligne;$i++)
                        {
      
                           for($j=0;$j<$this->colonne;$j++)
                              {
     
                                  $this->M[$i][$j]=$_POST[$this->nom$i$j];
         }
    
                                    }
                                    echo "</table>";}


 public function afficher()
      {
                  echo"<table width='200' border='1'>";
        
       
                             for($i=0;$i<$this->ligne;$i++)
                                       {
                                             echo "<tr>";
                              for($j=0;$j<$this->colonne;$j++)
                                            {
                
                                      echo "<td>".$this->M[$i][$j]."</td>";
             
   
           }
             
                                            echo "</tr>";
           }
          
                                                    echo "</table>";
     
                                                   }
    
?>
0