PHP - ¿como seleccionar radio button segun la base de datos?

 
Vista:
sin imagen de perfil

¿como seleccionar radio button segun la base de datos?

Publicado por luis (2 intervenciones) el 14/11/2019 06:35:59
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<form method="post" id="attendance_form">
  <div class="modal-content">
 
    <!-- Modal Header -->
    <div class="modal-header">
      <h4 class="modal-title" id="modal_title"></h4>
 
    </div>
 
    <!-- Modal body -->
    <div class="modal-body">
      <?php
      foreach($result as $row)
      {
      ?>
      <div class="form-group">
        <div class="row">
          <label class="col-md-4 text-right">Grado <span class="text-danger">*</span></label>
          <div class="col-md-8">
            <?php
          echo '<input  readonly="readonly" type="text" id="nom_grado" name="nombre_grado" value="'. $row["grado_nombre"] .'">';
 
            ?>
          </div>
        </div>
      </div>
      <div class="form-group">
        <div class="row">
          <label class="col-md-4 text-right">Fecha <span class="text-danger">*</span></label>
          <div class="col-md-8">
 
          <?php
 
setlocale(LC_ALL, 'es_PE.UTF-8');
date_default_timezone_set('UTC');
 
date_default_timezone_set("America/Lima");
$fechass= date("y-m-d");
          ?>
 
            <input type="text" name="attendance_date" id="attendance_date" class="form-control" value="<?php echo $fechass; ?>" readonly='true'>
            <span id="error_attendance_date" class="text-danger"></span>
          </div>
        </div>
      </div>
 
 
      <div class="form-group" id="student_details">
        <div class="table-responsive">
          <table class="table table-striped table-bordered">
            <thead>
              <tr>
                <th>Id</th>
                <th>Nombre</th>
                <th>Presente</th>
                <th>Falta</th>
                <th>Tarde</th>
              </tr>
            </thead>
      <?php
      $sub_query = "
      SELECT * FROM tbl_alumno 
      WHERE grado_id = '".$row["grado_id"]."'
      ";
      $statement = $connect->prepare($sub_query);
      $statement->execute();
      $student_result = $statement->fetchAll();
      foreach($student_result as $student)
      {
      ?>
            <tr>
              <td><?php echo $student["id_lista"]; ?></td>
              <td>
                <?php echo $student["alumno_nombre"]; ?>
                <input type="hidden" name="student_id[]" value="<?php echo $student["alumno_id"]; ?>" />
              </td>
              <td align="center">
                <input type="radio" name="attendance_status<?php echo $student["alumno_id"]; ?>" value="Presente" />
              </td>
              <td align="center">
                <input type="radio" name="attendance_status<?php echo $student["alumno_id"]; ?>" value="Falta" />
              </td>
               <td align="center">
                <input type="radio" name="attendance_status<?php echo $student["alumno_id"]; ?>" value="Tarde" />
              </td>
 
            </tr>
      <?php
      }
      ?>
          </table>
        </div>
      </div>
      <?php
      }
      ?>
    </div>
 
    <!-- Modal footer -->
    <div class="modal-footer">
      <input type="hidden" name="attendance_id" id="attendance_id" />
      <input type="hidden" name="action" id="action" value="agregar" />
      <input type="submit" name="button_action" id="button_action" class="btn btn-success btn-sm" value="agregar" />
    </div>
 
  </div>
</form>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
1
Responder