Ver Mensaje Individual
  #15 (permalink)  
Antiguo 04/04/2012, 10:08
rascabuchitos
 
Fecha de Ingreso: abril-2011
Ubicación: Peru
Mensajes: 486
Antigüedad: 13 años
Puntos: 9
Respuesta: resultados en mi web

hola amigos
hay un error agradecria mucho su ayuda
http://grupogba.com/m1.php

<?php
$state = false;
$conexion = mysql_connect("localhost", "mayito_luchito", "ninguna");
mysql_select_db("mayito_conta", $conexion);

# Verifico si precionaste el boton para enviar el formulario
if ( (isset($_POST['Submit'])) && (!empty($_POST['Submit'])) ) {

# Verifico que las variables no esten vacias y no contenga el texto por defecto de la caja
if(comprobar($_POST['comprobante'],'Comprobante') && comprobar($_POST['ruc'],'RUC') && comprobar($_POST['razon'],'Razon Social')){
$que = "INSERT INTO empresa (comprobante, ruc, razon) ";
$que.= "VALUES ('".$_POST['comprobante']."', '".$_POST['ruc']."', '".$_POST['razon']."') ";
$res = mysql_query($que, $conexion) or die(mysql_error());
$state = true;

# Luego que termino de insertar todo los datos destruyo las variables, evitando asi que cuando refresque la pagina se vuelva hacer un insert
unset($_POST );
}
}
$queEmp = "SELECT * FROM empresa ORDER BY comprobante asc";
$resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
$totEmp = mysql_num_rows($resEmp);
$reg = mysql_fetch_array($query,MYSQL_BOTH);
# Almacenamos los resultados de la query en una array para poder imprimirlos
while ($reg)

#Esta funcion verifica que la variable que postea no este vacia ni que su valor sea igual al default
function comprobar($var,$value ){

if( !empty($var) ){

if( $var == $value ){
$var = " ";
}

return true;
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>.:: CeIS ::.</title>
<style type="text/css">
<!--
body {
font-family: "Trebuchet MS", Tahoma, Arial;
font-size: 12px;
color: #333333;
}
h2 {
font-size: 16px;
color: #CC0000;
}
input, select {
font-family: "Trebuchet MS", Tahoma, Arial;
font-size: 11px;
color: #666666;
}
-->
</style>
</head>
<body>
<h2>.:: Ingreso de datos - CIS ::.</h2>
<form id="insertar" name="insertar" method="post" action="">
<p>
<input name="comprobante" onfocus="if(this.value==this.defaultValue)this.val ue='';" onblur="if(this.value=='')this.value=this.defaultV alue;" type="text" id="comprobante" value="Comprobante" size="20" />
</p>
<p>
<?php echo $reg['comprobante']; //Imprimimos los comprobantes?>
</p>
<p>
<input name="ruc" onfocus="if(this.value==this.defaultValue)this.val ue='';" onblur="if(this.value=='')this.value=this.defaultV alue;" type="text" id="ruc" value="RUC" size="20" />
</p>
<?php echo $reg['ruc']; //Imprimimos ruc ?>
<p>
<input name="razon" onfocus="if(this.value==this.defaultValue)this.val ue='';" onblur="if(this.value=='')this.value=this.defaultV alue;" type="text" id="razon" value="Razon Social" size="20" />
</p>
<?php echo $reg['razzon'] // Imprimimos Razon Social ?>
<input type="submit" name="Submit" value="Insertar Registro" />
<input type="hidden" name="action" value="add" />

<?php } //cerramos el while ?>
</form>
<?php if ($state) { ?>
<p><em>Registro insertado correctamente</em></p>
<?php } ?>
</body>
</html>