8722 sujets

Développement web côté serveur, CMS

Bonjour à tous,
Je poste ce message car j'éprouve des difficultés à enregistrer en base les valeurs que je peux attribuer à mes champs input de type checkbox.

Mon but serait qu'après avoir coché ou décoché mes différentes checkbox presence, les valeurs de celles ci s'enregistrent en base après le clique de la disquette save orange.
Actuellement au clique de cette disque je suis redirigé vers l'url update_pres qui ne m'affiche rien et qui n'enregistre rien.

En espèrant avoir été clair, merci à vous.

View


<table class="bordered highlight responsive-table" id="Seats">
    <tr>
        <th>#</th>
        <th>NNI</th>
        <th>Nom</th>
        <th>email</th>
        <th>Manager</th>
        <th>Service</th>
        <th>convocation</th>
        <th>presence</th>
        <th>action</th>
    </tr>

    <?php foreach ( $seats as $index => $seat ) : ?>
        <tr seat_id=<?php echo $seat->seat_id ?> >
            <td><?php echo $seat->seat_id ?></td>
            <td><?php echo $seat->nni ?></td>
            <td><?php echo $seat->name ?></td>
            <td><?php echo $seat->email ?></td>
            <td><?php echo $seat->managerName ?></td>
            <td><?php echo $seat->service ?></td>
            
            <td><?php echo convocation( $seat->convocation ) ?></td>
            <td>
            <!-- checkbox Presence -->
                <input id='<?php echo $seat->seat_id; ?>' class="filled-in" type="checkbox" name="presence" <?php if($seat->presence==true) echo 'checked="checked"'; ?> /> <label title="presence" for="<?php echo $seat->seat_id; ?>"></label>
            </td>
            <td>
            <!-- Boutons actions -->
                <button title="journal" class="btn-floating waves-effect waves-light green" id="viewLog" object="seat" object_id="<?php echo $seat->seat_id ?>" ><i class="material-icons">history</i></button>
                <a title="modifier" class="btn-floating waves-effect waves-light blue" href="<?php echo site_url( 'seat/edit/' . $seat->seat_id ) ?>"><i class="material-icons left">edit</i></a>
                <a title="envoyer un mail" class="btn-floating waves-effect waves-light yellow" href="<?php echo site_url( 'email/sendOneSeat/' . $seat->seat_id ) ?>" ><i class="material-icons">send</i></a>
                <a title="supprimer" class="btn-floating waves-effect waves-light red modal-trigger" href="<?php echo site_url( 'seat/delete/' . $seat->seat_id ) ?>"><i class="material-icons">delete</i></a>
            </td>
        </tr>
    <?php endforeach ?>
</table>

<!-- Boutons Ajout + Maj presence -->
<div class="card-action">
    <a title="Ajouter un participant" class="btn-floating btn-large waves-effect waves-light blue" href="<?php echo site_url( 'seat/add/' . $meeting->meeting_id ) ?>" ><i class="material-icons">person_add</i></a>
<a title="mettre à jour la présence" class="btn-floating btn-large waves-effect waves-light orange" id="update_presence_seat" href="<?php echo site_url('seat/update_pres') ?>"><i class="material-icons">save</i></a>
</div>



Controller

public function update_pres() {

		$seat_id=$this->input->post( 'seat_id' );
		if($this->input->post( 'presence' )=="true"){
			$pres=1;
		}else {
			$pres=0;
		}
		 $this->seat_model->update( array( 'seat_id' => $seat_id ), array(
			'presence' => $pres,
		));

		redirect( 'meeting/view/' .  $seat->meeting_id );	
	}



Visuel (url : meeting/view/id)
upload/1599048612-80834-visuelcache.png
Modifié par Jisiiss (02 Sep 2020 - 15:14)