RagazzoRosso
Bovino Milenario
- Desde
- 19 Jul 2007
- Mensajes
- 1.665
- Tema Autor
- #1
Que tal hermanos bakunos, les escribo porque después de estar leyendo tutoriales y tutoriales tengo un problema con mi formulario de registro el cual al dar click en el botón de envíar se supone que hace un envío de datos a la BD y en esta tengo un campo que genera un consecutivo pero sucede que únicamente genera este consecutivo y los datos no son guardados en los campos correspondientes, sino que se quedan vacíos.
Les expongo mi código y espero puedan ayudarme.
De antemano muchas gracias
Este es el código del formulario:
Y este es el código del php
Les expongo mi código y espero puedan ayudarme.
De antemano muchas gracias
Este es el código del formulario:
Código:
<html xmlns="[URL]http://www.w3.org/1999/xhtml[/URL]">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="Javascript">
function fixElement(element, message) {
alert(message);
element.focus();
}
function RevisaForma(forma) {
var error = 0;
if((forma.numeco.value == '') && (error == 0)) {
fixElement(forma.numeco, "Proporcione el número económico.");
error = 1;
}
if((forma.titulo.value == '') && (error == 0)) {
fixElement(forma.titulo, "Proporcione el título del proyecto.");
error = 1;
}
//if((forma.fechainicio.value == '') && (error == 0)) {
// fixElement(forma.fechainicio, "Proporcione la fecha de inicio.");
// error = 1;
//}
if((forma.sintesis.value == '') && (error == 0)) {
fixElement(forma.sintesis, "Proporcione la síntesis del proyecto. Máximo 512 caracteres.");
error = 1;
}
//if((forma.observaciones.value == '') && (error == 0)) {
// fixElement(forma.observaciones, "Proporcione Telefono");
// error = 1;
//}
if((forma.palabrasclave.value == '') && (error == 0)) {
fixElement(forma.palabrasclave, "Proporcione las palabras clave.");
error = 1;
}
if (error == 1) {
return false;
}else{
if(confirm('¿Esta seguro que sus datos estan correctos?')) {
document.registro.submit();
return true;
}else{
return false;
}
}
}
</script>
<title>Registro</title>
<style type="text/css">
<!--
body {
background-color: #333333;
}
-->
</style></head>
<body>
<center>
<form name="registro" action= "procesa3.php" method= "POST" >
<table width="510" border="0" bgcolor="#669900">
<tr>
<th colspan="2" align="right" scope="col"><div align="center">Número económico:
<input type="text" name="numeco" onKeypress="if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;">
</div></th>
</tr>
<tr>
<th width="124" align="right" scope="row">Título:</th>
<td width="174"><input name="titulo" type="text" size="100"></td>
</tr>
<tr>
<th scope="row" align="right"> </th>
<td> </td>
</tr>
<tr>
<th scope="row" align="right"> </th>
<td> </td>
</tr>
<tr>
<th scope="row" align="right"><p>Fecha de inicio:</p></th>
<td><input type="text" name="fechainicio"> (AAAA-MM-DD)</td>
</tr>
<tr>
<th scope="row" align="right">Síntesis del proyecto: </th>
<td><textarea name="sintesis" cols="85" rows="6"></textarea></td>
</tr>
<tr>
<th scope="row" align="right"> </th>
<td> </td>
</tr>
<tr>
<th scope="row" align="right">Observaciones:</th>
<td><textarea name="observaciones" cols="85" rows="6"></textarea></td>
</tr>
<tr>
<th scope="row" align="right">Palabras clave: </th>
<td><input type="text" name="palabrasclave"></td>
</tr>
<tr>
<th scope="row" align="right"> </th>
<td> </td>
</tr>
</table>
<input type="button" value='Enviar' onClick="javascript:RevisaForma(registro);"/>
</form>
</center>
</body>
</html>
Y este es el código del php
Código:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=350,height=230');");
}
javascript:popUp('mensaje.php')
// End -->
</script>
<body bgcolor="#333333">
</body>
<?php
$Respon=$_POST['numeco'];
$Titulo=$_POST['titulo'];
$Palabras=$_POST['palabrasclave'];
$Inicio=$_POST['fechainicio'];
$Sintesis=$_POST['sintesis'];
$Obs=$_POST['observaciones'];
$query = "INSERT INTO 5ProyInvReg (Respon,Titulo,Palabras,Inicio,Sintesis,Obs) values ('$numeco','$titulo','$palabrasclave','$fechainicio','$sintesis','$observaciones')";
function Conectarse()
{
if (!($link=mysql_connect("localhost","marcodelalama","sistemadivisional")))
{
echo "Error conectando a la base de datos.";
exit();
}
if (!mysql_select_db("marcodelalama",$link))
{
echo "Error seleccionando la base de datos.";
exit();
}
return $link;
}
$link=Conectarse();
$sqlquery= mysql_query($query);
mysql_close($link);
?>