PHP - AUTOCOMPLETAR FORMULARIO

 
Vista:

AUTOCOMPLETAR FORMULARIO

Publicado por tomas villareal (1 intervención) el 10/11/2015 02:17:25
Buenas

Soy en nuevo en php les pediría si me pueden ayudar

Lo que pasa es que tengo que ingresar un código y el campo del nombre se autocomplete para después seguir llenando el formulario y guardarlo
Yo he hecho que guarde pero tiene que ingresar el nombre manualmente

las tablas son diferentes en una esta los cod y nombre
y en la otra una vez capturado el nombre pasar a guardarlo



-------------------------------registro_of.php-----------------------------------

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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--<script type='text/javascript' src='includes/js/jquery.js'></script>-->
<!--<script type="text/javascript" src="includes/js/jquery.min.js"></script>-->
 
 
<html xmlns="http://www.w3.org/1999/xhtml" lang="es" xml:lang="es">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>SISTEMA WEB DE AUDITORIA - AUDIWEB</title>
<link rel="stylesheet" type="text/css" href="">
<!--< <script type="text/javascript" src=""></script>-->
<script type="text/javascript" src="HTML5-Forms-stylesheet.css"> </script>
 
<link rel="stylesheet" href= "includes/css/demos.css" type="text/css" />
<style type="text/css"> @import url("calendar-win2k-cold-1.css"); </style>
<link rel="stylesheet" href= "includes1/css/tema_auditoria.css" type="text/css" />
</script>
 
<SCRIPT>
function fixElement(element, message) {
alert(message);
element.focus();
}
 function verifica(form1) {
var passed = false;
if (form1.rus2.value == "") {
fixElement(form1.rus2, "Ingrese RUC.");
}
else if (form1.contribu2.value == "") {
fixElement(form1.contribu2, "Ingrese Contribuyente.");
}
else if (form1.regof.value == "") {
fixElement(form1.regof, "Ingrese Registro para Orden de Fiscalización.");
}
else if (form1.infr2.value == "Elegir") {
fixElement(form1.infr2, "Eliga una Infracción.");
}
else if (form1.docu2.value == "") {
fixElement(form1.docu2, "Seleccione un Archivo.");
}
else{
passed = true;
}
return passed;
}
</SCRIPT>
 
</head>
<body onLoad="this.document.form1.rus2.focus();">
     <header id="main-header">
       <span class="site-name"></span>
</header>
<hgroup>
     <h3><P ALIGN=center>Procedimiento Ingreso Como Recaudación</h3>
<section class="content-header">
                    <h1></h1>
 
               <h/5></section>
 
  </hgroup>
<form name="form1" action="guardar_of.php" method="post" onSubmit = "return verifica(this);" enctype="multipart/form-data">
<CENTER>
</TABLE>
<CENTER>
<TABLE BGCOLOR="F9FBFC" BORDERCOLOR="EAEAEB"  BORDER=5 WIDTH=50%"  CellPadding=10 CellSpacing=1>
<TR>
   <TD colspan=2 BGCOLOR="40A8B5" style="color:#FFFFFF"><B><h3>Registro Orden de Fiscalización</h3></B></TD>
<TR>
   <TD align=left><B>RUC:</B></TD>
   <TD align=left> <input type="text" name="rus2"  onmouseover="this.style.backgroundColor='#FDFDF8'" style="background-color:#FBF9D5" onmouseout="this.style.backgroundColor='#FBF9D5'" onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;"/>
   </TD>
<TR>
   <TD align=left><B>Nombre o Razón Social:</B> </TD>
   <TD align=left> <INPUT TYPE="text" NAME="contribu2" SIZE=58 onmouseover="this.style.backgroundColor='#FDFDF8'" style="background-color:#FBF9D5" onmouseout="this.style.backgroundColor='#FBF9D5'"/></TD>
<input type="hidden" name="opcion2" value="Orden de Fiscalización">
   <TR>
   <TD align=left><B>Registro de<br> Orden de Fiscalización:</B> </TD>
   <TD align=left> <INPUT TYPE="text" NAME="regof" onmouseover="this.style.backgroundColor='#FDFDF8'" style="background-color:#FBF9D5" onmouseout="this.style.backgroundColor='#FBF9D5'" onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;"/></TD>
<TR>
   <TD align=left><B>Infracción Cometida:</B></TD>
   <TD align=left> <SELECT NAME="infr2" style="background-color:#FBF9D5"/>
            <OPTION>Elegir
            <OPTION>1.- NOM1 ART 177CT
            <OPTION>2.- NOM5 ART 177CT
      </SELECT><B> Escoja una opción</B></TD>
<input type="hidden" name="fechof" value="">
<TR>
   <TD colspan=2 align=right><h10>* Estructura de Ingreso de archivo OF.pdf (12345678959.pdf)</h10></TD>
<TR>
  <TD align=left><B>
   Documentos <br>Orden de Fiscalización:</B><TD align=left> <input SIZE=35 type="file" name="docu2" onmouseover="this.style.backgroundColor='#FDFDF8'" style="background-color:#FBF9D5" onmouseout="this.style.backgroundColor='#FBF9D5'"/></TD>
 
<input type="hidden" name="revisa" value="Pendiente">
<input type="hidden" name="obser" value="">
<input type="hidden" name="obserof" value="">
 
</TABLE>
</CENTER>
<TR>
    <TD>
    <br/>
    <center>
 <input type="submit" name="gua" value="Guardar">
 <input type="reset" name="can" value="Cancelar">
 <input type="button" name="reg" value="Regresar" onClick="history.back()">
       </center>
</form>
 </body>
 </html>

-----------------registrar_of.php-------------------------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
require_once("conexion.php");
$rucs2=$_POST['rus2'];
$contribuyen2=$_POST['contribu2'];
$opcions2=$_POST['opcion2'];
$regof2=$_POST['regof'];
$esta2=$_POST['infr2'];
$fech=date("Y/n/d");
$fechof2=date("0000/00/00");
$docum2=$_FILES['docu2']['name'];
$temp=$_FILES['docu2']['tmp_name'];
copy($temp,"data1/documents1/".$docum2);
$revisa2=$_POST['revisa'];
$obser2=$_POST['obser'];
$obserof2=$_POST['obserof'];
$sql="insert into tbldocumentosicr values(null,'$rucs2','$contribuyen2','$opcions2','$regof2','$esta2','$fech','$fechof2','$docum2','$revisa2','$obser2','$obserof2')";
 
mysql_query($sql,$cnx);
header ("location: registro_of.php");
?>



----------BD---------
tabla_1
ruc contribuye
2 juan
3 carlos
4 andrea

tabla_2

ruc| contribuye |tipo_registro |registro |infrac |fech1 |fech2 |docu |rev | obs1|obs2
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder