Ver Mensaje Individual
  #16 (permalink)  
Antiguo 04/04/2012, 14:15
Avatar de IsaBelM
IsaBelM
Colaborador
 
Fecha de Ingreso: junio-2008
Mensajes: 5.032
Antigüedad: 15 años, 10 meses
Puntos: 1012
Respuesta: resultados en mi web

prueba ahora
Código PHP:
Ver original
  1. <?php
  2. #Esta funcion verifica que la variable que postea no este vacia ni que su valor sea igual al default
  3. function comprobar($var,$value ){
  4.  
  5.  return strcmp($var, $value);
  6.  
  7.  }
  8.  
  9.  $state = false;
  10.  $conexion = mysql_connect("localhost", "mayito_luchito", "ninguna");
  11.  mysql_select_db("mayito_conta", $conexion);
  12.  
  13.  # Verifico si precionaste el boton para enviar el formulario
  14. if ( (isset($_POST['Submit'])) && (!empty($_POST['Submit'])) ) {
  15.  
  16.  # Verifico que las variables no esten vacias y no contenga el texto por defecto de la caja
  17. if((comprobar($_POST['comprobante'],'Comprobante') == 1) && (comprobar($_POST['ruc'],'RUC') ==1) && (comprobar($_POST['razon'],'Razon Social') == 1)){
  18.  $que = "INSERT INTO empresa (comprobante, ruc, razon) ";
  19.  $que.= "VALUES ('".$_POST['comprobante']."', '".$_POST['ruc']."', '".$_POST['razon']."') ";
  20.  $res = mysql_query($que, $conexion) or die(mysql_error());
  21.  $state = true;
  22.  
  23.  # Luego que termino de insertar todo los datos destruyo las variables, evitando asi que cuando refresque la pagina se vuelva hacer un insert
  24. unset($_POST );
  25.  }
  26.  }
  27.  
  28. $queEmp = "SELECT * FROM empresa ORDER BY comprobante asc";
  29.  $resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
  30.  $totEmp = mysql_num_rows($resEmp);
  31.  $reg = mysql_fetch_array($query);
  32.  # Almacenamos los resultados de la query en una array para poder imprimirlos
  33.  
  34.  ?>
  35.  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  36.  <html xmlns="http://www.w3.org/1999/xhtml">
  37.  <head>
  38.  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  39.  <title>.:: CeIS ::.</title>
  40.  <style type="text/css">
  41.  <!--
  42.  body {
  43.  font-family: "Trebuchet MS", Tahoma, Arial;
  44.  font-size: 12px;
  45.  color: #333333;
  46.  }
  47.  h2 {
  48.  font-size: 16px;
  49.  color: #CC0000;
  50.  }
  51.  input, select {
  52.  font-family: "Trebuchet MS", Tahoma, Arial;
  53.  font-size: 11px;
  54.  color: #666666;
  55.  }
  56.  -->
  57.  </style>
  58.  </head>
  59.  <body>
  60.  <h2>.:: Ingreso de datos - CIS ::.</h2>
  61.  <form id="insertar" name="insertar" method="post" action="">
  62.  <p>
  63.  <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" />
  64.  </p>
  65.  <p>
  66.  <?php  while ($reg) { echo $reg['comprobante']; }//Imprimimos los comprobantes?>
  67.  </p>
  68.  <p>
  69.  <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" />
  70.  </p>
  71.  <?php  while ($reg) {echo $reg['ruc'];} //Imprimimos ruc ?>
  72.  <p>
  73.  <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" />
  74.  </p>
  75.  <?php  while ($reg) {echo $reg['razzon'];} // Imprimimos Razon Social ?>
  76.  <input type="submit" name="Submit" value="Insertar Registro" />
  77.  <input type="hidden" name="action" value="add" />
  78.  
  79.  
  80.  </form>
  81.  <?php if ($state) { ?>
  82.  <p><em>Registro insertado correctamente</em></p>
  83.  <?php } ?>
  84.  </body>
  85.  </html>
__________________
if(ViolenciaDeGénero) {alert('MUJER ASESINADA');}