
Ir a otra pagina con una variable y recuperarla
Publicado por jexica (11 intervenciones) el 29/07/2014 21:16:12
Hola estoy haciendo una tabla para mostrar datos y todo va bien, pero deseo colocar un boton link o imagen que me lleve a ver el registro con todos sus datos, me explico mejor montando el codigo
#1 Codigo html para generar dataTable
#2 Funcion de la clase equipo que me permite extaer datos
#3 Recibo dato
El problema es que cuando presiono el boton ver me dice que la variable serial no esta definida, espero alguien pueda ayudarme
#1 Codigo html para generar dataTable
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
<head>
<meta charset="utf-8">
<!-- ESTILO GENERAL -->
<link type="text/css" href="../css/styledata.css" rel="stylesheet" />
<!-- ESTILO GENERAL -->
<!-- JQUERY -->
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="../js/funciones.js"></script>
<!-- JQUERY -->
<!-- FORMATO DE TABLAS -->
<link type="text/css" href="../css/demo_table.css" rel="stylesheet" />
<script type="text/javascript" language="javascript" src="../js/jquery.dataTables.js"></script>
<!-- FORMATO DE TABLAS -->
</head>
<body>
<div align="left"><BLOCKQUOTE><a href="menu.php"><b>Menu Principal</b></a><br /></BLOCKQUOTE> </div>
<header id="titulo">
<h3>Consulta de Equipos</h3>
</header>
<script type="text/javascript" language="javascript" src="../js/jslistadopaises.js"></script>
<table cellpadding="0" cellspacing="0" border="0" class="display" id="tabla_equipo">
<thead>
<tr>
<th>Serial</th><!--Estado-->
<th>Tipo de Equipo</th>
<th>Marca</th>
<th>Modelo</th>
<th>Mac</th>
<th>Tienda</th>
<th>Departamento</th>
<th>Fecha de <br> Modificacion</th>
<th>Ver</th>
</tr>
</thead>
<tfoot>
<tr>
<th></th>
<th></th>
</tr>
</tfoot>
<tbody>
<?php
require_once('../controlador/equipo.php');
$equipo = new equipo();
$consulta = $equipo->consultadata(); // me permite recorrer la tabla y traer los datos
echo $consulta;
?>
<tbody>
</table>
</body>
#2 Funcion de la clase equipo que me permite extaer datos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function consultadata (){
$conexion = $this->mysql->conectar();
$sql="SELECT *FROM equipo"; //ordeno y limito la consulta por fecha de modificacion
$consulta = $this->mysql->consultar($sql,$conexion);
while($reg= mysql_fetch_array($consulta))
{
echo '<tr>';
echo '<td >'.mb_convert_encoding($reg['serial'], "UTF-8").'</td>';
echo '<td>'.mb_convert_encoding($reg['nom_tipo'], "UTF-8").'</td>';
echo '<td>'.mb_convert_encoding($reg['nom_marca'], "UTF-8").'</td>';
echo '<td>'.mb_convert_encoding($reg['modelo'], "UTF-8").'</td>';
echo '<td>'.mb_convert_encoding($reg['mac'], "UTF-8").'</td>';
echo '<td>'.mb_convert_encoding($reg['nom_tienda'], "UTF-8").'</td>';
echo '<td>'.mb_convert_encoding($reg['nom_dpto'], "UTF-8").'</td>';
echo '<td>'.mb_convert_encoding($reg['fecha_mod'], "UTF-8").'</td>';
echo '<td>'.'<a href="../vista/visualiza_consulta.php?serial=$reg[serial]">Ver</a>'.'</td>'; // aqui se supone que envio el dato por url
echo '</tr>';
}
}
#3 Recibo dato
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
session_start();
require_once('../controlador/equipo.php');
require_once('../controlador/usuario.php');
$serial=$_POST['serial']; // se supone que recibo el dato desde la url
$equipo=new equipo();
$consulta=$equipo->datos ($serial); // Consulta datos del equipo
$cod_equipo=$consulta['cod_equipo'];
$serial=$consulta['serial'];
$tipo_equipo=$consulta['nom_tipo'];
$marca=$consulta['nom_marca'];
$modelo=$consulta['modelo'];
$mac=$consulta['mac'];
$ano=$consulta['ano'];
$fecha_compra=$consulta['fecha_compra'];
$garantia=$consulta['garantia'];
$descripcion=$consulta['descripcion'];
$proveedor=$consulta['nom_provee'];
$tienda=$consulta['nom_tienda'];
$departamento=$consulta['nom_dpto'];
$nivel=$consulta['nom_nivel'];
$area=$consulta['nom_area'];
$fecha_mod=$consulta['fecha_mod'];
$cedula=$consulta['id_cedula'];
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Consulta</title>
<link rel="stylesheet" type="text/css" href="../css/tabla_style.css">
</head>
<body>
<!--Formulario q trae todos los datos del equipo con campos deshabilitados para modificacion -->
<table width="732" height="244" border="10px" align="center" bgcolor="#FFFFCC" class=".dos" vspace="0" >
<td width="288"> Codigo de Equipo:
<input type= "text" name="cod_equipo" disabled="" value="<?php echo $cod_equipo;?>" size="5" /></td>
<td width="250"> Serial:
<input type= "text" name="serial" size="20" disabled="" value="<?php echo $serial;?>" /></td>
</tr>
<tr>
<td width="312"> Tipo de Equipo:
<input type= "text" name="tipo_equipo" size="20" disabled="" value="<?php echo $tipo_equipo;?>" />
</td>
<td width="386"> Marca:
<input type= "text" name="marca" size="20" disabled="" value="<?php echo $marca;?>" />
</td>
</tr>
<tr>
<td> Modelo:
<input type= "text" name="modelo" size="20" disabled="" value="<?php echo $modelo;?>" />
</td>
<td> Mac:
<input type= "text" name="mac" size="20" disabled="" value="<?php echo $mac;?>" /> </td>
</tr>
<tr>
<td> Año:
<input type= "text" name="ano" size="10" disabled="" value="<?php echo $ano;?>" />
</td>
<td> Fecha de Compra:
<input type= "text" name="fecha_compra" size="10" disabled="" value="<?php echo $fecha_compra;?>" />
</td>
</tr>
<tr>
<td> Garantia:
<input type= "text" name="garantia" size="10" disabled="" value="<?php echo $garantia;?>" />
</td>
<td> Descripcion: <br>
<input type= "text" name="descripcion" size="50" disabled="" value="<?php echo $descripcion;?>" />
</td>
</tr>
<tr>
<td> Proveedor:
<input type= "text" name="proveedor" size="20" disabled="" value="<?php echo $proveedor;?>" />
<td> Tienda:
<input type= "text" name="nom_tienda" size="20" disabled="" value="<?php echo $tienda;?>" />
</td>
</tr>
<tr>
<td> Departamento:
<input type= "text" name="nom_dpto" size="20" disabled="" value="<?php echo $departamento;?>" />
</td>
<td> Nivel:
<input type= "text" name="nom_nivel" size="20" disabled="" value="<?php echo $nivel;?>" />
</td>
</tr>
<tr>
<td > Area:
<input type= "text" name="nom_area" size="20" disabled="" value="<?php echo $area;?>" />
</td>
<td> Usuario:
<input type= "text" name="cedula" size="20" disabled="" value="<?php echo $cedula;?>" />
</td>
</tr>
<tr>
<td height="41" colspan="2" align="center" > Fecha de Modificacion:
<input type= "text" name="fecha_mod" size="10" disabled="" value="<?php echo $fecha_mod;?>" />
</td>
</tr>
<tr>
<td height="41" colspan="2" align="center" >
<script language="javaScript">
function fVolver(){
document.location.href = "vista_consulta.php";
}
</script>
</head>
<input type="button" name="volver" id="volver" value="Volver" onClick="javaScript:fVolver();">
</td>
</form>
</tr>
</table>
</body>
</html>
El problema es que cuando presiono el boton ver me dice que la variable serial no esta definida, espero alguien pueda ayudarme
Valora esta pregunta


0