![sin imagen de perfil sin imagen de perfil](/img/anonymouse.png)
Como hacer que al dar clic en guardar cambios se actualice la información
Publicado por José Saúl (1 intervención) el 17/05/2017 07:35:48
como puedo hacer para que al dar clic en guardar cambios se actualice la información en la base de datos?
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
p.simulaLink {color: blue; cursor:pointer;}
</style>
<script type="text/javascript">
function transformarEnEditable(nodo) {
var nodoContent = nodo.querySelectorAll("p");
var claveInicial = nodoContent[0].firstChild.nodeValue;
var nombreInicial = nodoContent[1].firstChild.nodeValue;
var especialidadInicial = nodoContent[2].firstChild.nodeValue;
var consultorioInicial = nodoContent[3].firstChild.nodeValue;
var unidadInicial = nodoContent[4].firstChild.nodeValue;
var cedulaInicial = nodoContent[5].firstChild.nodeValue;
var nuevoCodigo = '<tr>'+
'<td> <input type="text" name="id" id="id" value="'+claveInicial+'" size="10"></td>'+
'<td> <input type="text" name="titulo" id="titulo" value="'+nombreInicial+'" size="10"></td>'+
'<td> <input type="text" name="texto" id="texto" value="'+especialidadInicial+'" size="20"></td>'+
'<td> <input type="text" name="categoria" id="categoria" value="'+consultorioInicial+'" size="10"></td>'+
'<td> <input type="text" name="fecha" id="fecha" value="'+unidadInicial+'" size="10"></td>'+
'<td> <input type="text" name="imagen" id="imagen" value="'+cedulaInicial+'" size="10"></td>'+
'<td> <p class="simulaLink">Guardar cambios</p>'+
'<p>Borrar</p></td>'+
'</tr>';
nodo.innerHTML = nuevoCodigo;
}
</script>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td><p><b>Clave</b></p></td>
<td><p><b>Nombre</b></p></td>
<td><p><b>Especialidad</b></p></td>
<td><p><b>Consultorio</b></p></td>
<td><p><b>Unidad Médica</b></p></td>
<td><p><b>Cedula Profesional</b></p></td>
<td> </td>
</tr>
<tr>
<td><p><?php echo $row['doc_cve']; ?></p></td>
<td><p><?php echo $row['doc_nombre']; ?></p></td>
<td><p><?php echo $row['doc_especialidad']; ?></p></td>
<td><p><?php echo $row['doc_consultorio']; ?></p></td>
<td><p><?php echo $row['doc_unidadmedica']; ?></p></td>
<td><p><?php echo $row['doc_ced_prof']; ?></p></td>
<td><p class = "simulaLink" onclick="transformarEnEditable(this.parentNode.parentNode)">Editar</p>
<p>Borrar</p></td>
</tr>
<?php } ?>
</tbody>
</table>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
$conexion = new PDO('mysql:host=localhost;dbname=hospital', 'root', '');
$sql = 'SELECT * FROM doctores';
$result = $conexion->query($sql);
$rows = $result->fetchAll();
?>
<?php
foreach ($rows as $row) {
?>
Valora esta pregunta
![Me gusta: Está pregunta es útil y esta clara Me gusta: Está pregunta es útil y esta clara](/img/img.png?11.51)
![NO me gusta: Está pregunta no esta clara o no es útil No me gusta: Está pregunta no esta clara o no es útil](/img/img.png?11.51)
0