Probleme sur le bouton modifier dans codeigniter3

Résolu
paolo -  
 paolo -
BONJOUR

quelqu'un qui peut m'aider en corrigeant l'eurreur dans mon programme .
je suis entrer de faire un boutton modifier en codeigniter 3 mais quand je clique sur boutton au lieu de modifier ca supprimer .
j'ai besion d'aider

2 réponses

  1. jordane45 Messages postés 30426 Date d'inscription   Statut Modérateur Dernière intervention   4 830
     
    Bonjour,

    1 - Je déplace ta question dans le forum PHP

    2 - Si tu ne nous montres pas ton code .. impossible de t'aider

    NB: Pour poster du code sur le forum tu devras utiliser les balises de code.
    Explications ( à lire entièrement !!!) disponibles ici : https://codes-sources.commentcamarche.net/faq/11288-les-balises-de-code
    0
  2. paolo
     
    voici notre code ci-dessous

    controlleur

    
    public function update_commune(){
            $id=$this->input->post('id_commune');
    
        $data=array(
            'nom_commune'=>$this->input->post('nom_commune'),
            'nom_DCE'=>$this->input->post('nom_DCE'),
            'code_DCE'=>$this->input->post('code_DCE'),
            'id_province'=>$this->input->post('province'),
    
    
        );
        $this->M_ecole->update_data('commune','id_commune',$id,$data);
    redirect('commune/table');
        
    }
    


    modele
     public function update_data($table_name,$id_table,$id,$data){
                $this->db->where($id_table, $id);
                $this->db->update($table_name, $data);
            }
    


    vue
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>commune</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
    </head>
    <body>
    <body>
      <div class="container">
      <div class="panel panel-primary margetop60">
    
        <div class="row">
            <div class="col-lg-12 margin-tb">
                <div class="pull-left">
                    <h2>Edit  Commune</h2>
                </div>
                <div class="pull-right">
                    <a class="btn btn-primary" href="<?php echo base_url('index.php/commune/table')  ?>"> Back</a>
                </div>
            </div>
        </div>
        <form method="post" action="<?php echo base_url('index.php/commune/update_commune') ?>">
        
    <input type="hidden" name="id_commune" value="<?php echo $table->id_commune ?>">
            <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-12">
                    <div class="form-group">
                        <strong>Nom du Commune:</strong>
                        <input type="text" name="nom_province"
                         class="form-control" value="<?php echo $table->nom_commune ?>" required autocomplete="off">
                                      </div>
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                    <div class="form-group">
                        <strong>Nom DCE:</strong>
                        <input type="text" name="nom_DPE"
                         class="form-control" value="<?php echo $table->nom_DCE ?>"  required autocomplete="off">
                                      </div>
                </div>  
                <div class="col-xs-12 col-sm-12 col-md-12">
                    <div class="form-group">
                        <strong>Code DCE:</strong>
                        <input type="text" name="code_DPE" value="<?php echo $table->code_DCE ?>"  class="form-control"  required autocomplete="off">
                                      </div>
                </div> 
                <div class="col-xs-12 col-sm-12 col-md-12">
                    <div class="form-group">
                        <strong>Nom du province:</strong>
                        <select name="province"id="etat" class="form-control">
                        <?php// foreach $post_table  as $post_table1 { ?>
                        <option value="">.......selectionner le nom de province....</option>
                        <option value="<?php// echo $post_table1['id_province']  ?>"><?php// echo $post_table1['nom_province']  ?></option>
    <?php // } ?>
                        </select>
                        </div>
                </div>
                
                            <div class="col-xs-12 col-sm-12 col-md-12 text-center">
                        <button type="submit" class="btn btn-primary">UPDATE</button>
                </div>
            </div>
        </form>
    
      </div>
      </div>
    </body>
    </html>
    

    EDIT : AJOUT DES BALISES DE CODE !!!!!!

    0