Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/01/2013, 14:37
Avatar de alfredox91
alfredox91
 
Fecha de Ingreso: noviembre-2012
Ubicación: Venezuela-Turmero- Aragua
Mensajes: 17
Antigüedad: 11 años, 5 meses
Puntos: 0
como consultar datos de una tabla mysql en un sitio web

buenas, he diseñado un archivo php en el sitio web que estoy haciendo para que la gente envié datos de relevancia hacia una bd, como lo es nombre, edad, cedula y esas cosas. ahora bien quisiera que la gente luego de enviar sus datos pudiera también consultarlos, es decir que al ingresar por ejemplo su numero de cédula y apretar ENTER aparezcan todos los datos que esa persona envio a la BD, actualmente estoy trabajando en local con wampserver, y este es el formulario que hice para enviar datos:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>


<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>consejo comunal</title>


<style type="text/css">
h3 {
font-family: Jokerman;
font-weight: bold;
font-style: normal;
text-transform: uppercase;
color: black;
}
body {
font-family: Algerian;
color: black;
}

</style></head><body style="color: rgb(0, 0, 0); background-color: white;" alink="#ee0000" link="#0000ee" vlink="#551a8b">
<a> </a>
<div style="text-align: left; background-color: rgb(204, 0, 0);"><a href="http://www.mppeu.gob.ve/"><img style="border: 0px solid ; width: 426px; height: 93px;" alt="" src="images/LOGOMINISTERIOPUBLICO.jpg"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp; &nbsp;<a href="http://www.misionsucre.gov.ve/"><img style="border: 0px solid ; width: 124px; height: 103px;" alt="" src="images/MISIONSUCRE.jpg"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <a href="http://www.upta.edu.ve/moodle/"><img style="border: 0px solid ; width: 140px; height: 105px;" alt="" src="images/upt.jpg"></a><br>
</div>

<dl>

<dt style="text-align: center;"><img style="width: 918px; height: 196px;" alt="" src="images/consejo-comunal.png"><br>
</dt>
</dl>

<div style="text-align: center;">
<h1 style="font-family: Century Gothic;"><span style="color: rgb(0, 255, 255); font-size: 32px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: rgb(255, 0, 0); display: inline ! important; float: none;"></span><span style="color: rgb(204, 0, 0); font-family: Jokerman;">BIENVENIDOS
AL SITIO WEB INFORMATIVO
DEL
CONSEJO COMUNAL "23 DE ENERO POLIGONAL 3 Y 4"</span></h1>
<img style="width: 165px; height: 183px;" alt="consejos" src="images/consejos_comunales.jpg"><br>
<br>
</div>

<hr>
<hr>
<table border="1" width="700">

<tbody>
<tr>
<td style="font-family: Jokerman;" bgcolor="navajowhite" width="100"><a href="INDEX.html">INICIO</a> </td>
<td style="font-family: Jokerman;" bgcolor="navajowhite" width="100"> <a href="UBICACION.html">UBICACION</a> </td>
<td style="font-family: Jokerman;" bgcolor="navajowhite" width="100"> <a href="NOSOTROS.html">NOSOTROS</a> </td>
<td style="font-family: Jokerman;" bgcolor="navajowhite" width="100">
<div style="text-align: left;"> <a href="CONTACTENOS.HTML">CONTACTENOS</a></div>
</td>
<td style="font-family: Jokerman;" bgcolor="navajowhite" width="100"> <a href="SALADECHAT.HTML">SALA DE CHAT</a> </td>
<td style="font-family: Jokerman;" bgcolor="navajowhite" width="100"> <a href="ZONADEDESCARGA.HTML">ZONA DE DESCARGA</a> </td>
</tr>
</tbody>
</table>

<hr>
<hr>
<div style="text-align: center;">dejanos tus datos llenando el siguiente formulario, la información enviada solo podrá ser manejada por el administrador.<br>
</div>


<?php $nombre=$_POST['nombre'];
$CI=$_POST['CI'];
$telefono=$_POST['telefono'];
$edad=$_POST['edad'];
$direccion=$_POST['direccion'];
$profesion=$_POST['profesion'];
$trabaja=$_POST['trabaja'];

if ($nombre!= "" && $CI!= "" && $telefono!= "" && $edad!= "" && $direccion!= "" && $profesion!= "" && $trabaja!="");
{
mysql_connect("localhost","nombre de usuario","contraseña");
mysql_select_db("nombre de la base de datos");

mysql_query("INSERT INTO habitantes(nombre,CI,telefono,edad,direccion,profe sion,trabaja) VALUES('$nombre','$CI','$telefono','$edad','$direc cion','$profesion','$trabaja')");

}
?>


<form id="form1" name="form1" method="post" action="">
<table align="center" border="1" width="441">
<tbody><tr>
<td style="font-family: Jokerman;" width="174">NOMBRE<br>
</td>
<td width="251"><label for="nombre"></label>
<input name="nombre" id="nombre" size="50" type="text">
<label for="nombre"></label></td>
</tr>
<tr>
<td style="font-family: Jokerman;">C.I</td>
<td><label for=""></label>
<input name="CI" id="CI" size="50" type="text"></td>
</tr>
<tr>
<td style="font-family: Jokerman;">TELEFONO<br>
</td>
<td><label for="telefono"></label>
<input name="telefono" id="telefono" size="50" type="text"></td>
</tr>
<tr>
<td style="font-family: Jokerman;">EDAD<br>
</td>
<td><label for="edad"></label>
<input name="edad" id="edad" size="10" type="text"></td>
</tr>
<tr>
<td style="font-family: Jokerman;">DIRECCION<br>
</td>
<td><label for="direccion"></label>
<input name="direccion" id="direccion" size="50" type="text"></td>
</tr>
<tr>
<td style="font-family: Jokerman;">PROFESION<br>
</td>
<td><label for="profesion"></label>
<input name="profesion" id="profesion" size="50" type="text"></td>
</tr>
<tr>
<td style="font-family: Jokerman;">TRABAJA<br>
</td>
<td><label for="trabaja"></label>
<input name="trabaja" id="trabaja" size="10" type="text"></td>
</tr>
<tr>
<td colspan="2" height="26"><div align="center">
<input name="button" id="button" value="Enviar" type="submit">
</div></td>
</tr>
</tbody></table>
</form>
<br>
<br>

<div style="text-align: center; background-color: rgb(102, 102, 0);"><a title="Document made with KompoZer" href="http://kompozer.net/"><img alt="Document made with KompoZer" src="http://kompozer.sourceforge.net/images/kompozer_80x15.png" border="0"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;<a href="https://www.dropbox.com/"><img style="border: 0px solid ; width: 129px; height: 29px;" alt="" src="images/dropbox.png"></a>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;
<small>mision sucre, todos los derechos reservados
</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<img style="width: 81px; height: 33px;" alt="" src="images/html.jpg">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<small style="color: rgb(204, 153, 51);"><big><span style="font-family: Adobe Gothic Std B; font-style: italic;">firefox</span></big>
</small><a href="http://www.mozilla.org/es-ES/firefox/new/"><img style="border: 0px solid ; width: 66px; height: 33px;" alt="" src="images/images.jpg"></a><br>
</div>
</body></html>

el código me funciona correcto ya que me captura todos los datos que envía, pero quiero hacer lo que mencione arriba que una persona pueda consultar sus datos luego de enviarlos ingresando su numero de cédula. se puede hacer dentro del mismo php? o tengo que crear otro archivo, y aparte tendría que hacer otra tabla en phpmyadmin que se relacione con la tabla que recibe los datos?, gracias de antemano