Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/08/2010, 15:03
marinella
 
Fecha de Ingreso: agosto-2010
Mensajes: 34
Antigüedad: 13 años, 8 meses
Puntos: 0
Pregunta Hacer validaciones con la base de datos de mysql

Buenas tardes, necesito hacer una validacion de algunos campos que estan en la base de datos:

tengo un formulario donde necesito cargar unos datos ingresados por consola, pero tambien hay unos campos que necesito que al yo digitar la informacion en uno de ellos me cargue inmediatamente los datos que hay almacenados en la base de datos en otra tabla.
<html>
<body>
<?php
if($enviar)
{
$con = mysql_connect("localhost","root","root");
mysql_select_db("laboratorio",$con);
$sql= "INSERT INTO ladpaqci (nu_paque,nu_secue,id_cds,id_softw,id_versi,nu_ser ia,nu_activ,nu_actpa,cd_ubifi) VALUES ('$nu_paque','$nu_secue','$id_cds','$id_softw','$i d_versi','" . $serial1 . "-" . $serial2 . "-" . $serial3 . "-" . $serial4 . "-" . $serial5 . "','$nu_activ','$nu_actpa','$cd_ubifi')";
$result = mysql_query($sql);
echo "<font color=Blue>el NUMERO DEL PAQUETE ingresado es: " . $nu_paque . "</font>";
echo "<font color=Blue>el NUMERO DEL PAQUETE ingresado es: " . $nu_secue . "</font>";
echo "<font color=Blue>el NUMERO DEL PAQUETE ingresado es: " . $id_cds . "</font>";
echo "<font color=Blue>el NUMERO DEL PAQUETE ingresado es: " . $id_softw . "</font>";
echo "<font color=Blue>el NUMERO DEL PAQUETE ingresado es: " . $id_versi . "</font>";
echo "<font color=Blue>el NUMERO DEL PAQUETE ingresado es: " . $nu_seria . "</font>";
echo "<font color=Blue>el NUMERO DEL PAQUETE ingresado es: " . $nu_activ . "</font>";
echo "<font color=Blue>el NUMERO DEL PAQUETE ingresado es: " . $nu_actpa . "</font>";
echo "<font color=Blue>el NUMERO DEL PAQUETE ingresado es: " . $cd_ubifi . "</font>";
?>
<center>
<h3><font color=Black><a href='nissan.html'>Aceptar</a></font></h3>
</center>
<?php
}
else
{
?>
<form name='menu' method='post' action='paquete.php'>
<table height="440"><tr><td></td>
<td><font color=Black><h5>No. PAQUETE:</font></td>
<td><input type='Text' name='nu_paque' size='6' maxlength='6'></td></tr>

<tr>
<td></td>
<td></td>
<fieldset>
<td><fieldset><legend><font color=Blue >*********</font></legend>

<fieldset><table width="158">
<tr><td width="1"></td><td width="83"><font color=Black><h6>No. SECUENCIA:</font></td>
<td width="58"><input type='Text' name='nu_secue' size='6' maxlength='6'></td>
</tr>
</table></fieldset><br>
<fieldset><table width="589">
<tr>
<td width="64" height="50" ><font color=Black>
<h6>CODIGO CD:</h6></td>
<td width="67"><select name='id-cds'> <option selected value= 'N/A'>-----<BR>
</select></td>
<td width="114"><font color=Black><h6>CODIGO SOFTWARE:</td>
<td width="89"><input type='Text' name='id_softw' size='6' maxlength='6'></font></td>
<td width="111"><font color=Black><h6>CODIGO VERSION:</td>
<td width="116"><input type='Text' name='id_versi' size='6' maxlength='6'></font></td>
</tr>
</table></fieldset><br>
<fieldset><table width="587">
<tr>
<td width="92" height="49"><font color=Black><h6>No. ACTIVO:</font></td>
<td width="83"><input type='Text' name='nu_activ' size='6' maxlength='6'></td>

<td width="111"><font color=Black><h6>No. ACTIVO PADRE:</font></td>
<td width="281"><input type='Text' name='nu_actpa' size='6' maxlength='6'></td></tr>
</table></fieldset><br>
<fieldset><table width="584">
<tr>
<td width="115"><font color=Black><h6>UBICACION FISICA:</font></td>
<td width="36" ><input type='Text' name='cd_ubifi' size='6' maxlength='6'></td>
<td width="315"><font color=Blue><h6>A-L-C (A2LB100)</font></td>
<td width="98"><font color=Blue><h6>A: ARMARIO<BR>L: LADO<BR>C: CONSECUTIVO</font></td>
</tr>
</table></fieldset><br>
<fieldset><table width="581">
<tr>
<td width="79" height='65'><font color=Black><h6>No. SERIAL:</font></td>
<td width="490"><input name='serial1' type='text' size='5' maxlength='5'>
<input name='serial2' type='text' size='5' maxlength='5'>
<input name='serial3' type='text' size='5' maxlength='5'>
<input name='serial4' type='text' size='5' maxlength='5'>
<input name='serial5' type='text' size='5' maxlength='5'></td>

</tr>

<tr>
<td ></d> <td > <center><input type='Submit' name='enviar' value = 'Adicionar'></center></d>
</tr>
</table></fieldset></fieldset>
</td></tr>
<tr></tr>
<tr><td ></d> <td ></d> <td ></d> <td width="62" > <center><input type='Submit' name='enviar' value = 'Guardar'></center></d>
<td width="0" ></d><td width="17" height='85' ></d></tr>
</table>
</form>
</div>
<?php
}
?>

</body>
</html>

en la parte del formulario donde esta la la casilla de CODIGO CD, DEBE HACER UN ENLACE CON LA BASE DE DATOS QUE YA DEBE ESTAR CARGADA LA INFORMACION EN OTRA TABLA Y INMEDIATAMENTE CARGAR CON LA INFORMACION DE LAS DOS CASILLAS QUE SON CODIGO SOFTWARE Y CODIGO VERSION.



no se si soy especifica en lo que quiero hacer pero no se que codigo colocar para que haga este enlace o validacion.