Ver Mensaje Individual
  #5 (permalink)  
Antiguo 23/03/2012, 13:25
rascabuchitos
 
Fecha de Ingreso: abril-2011
Ubicación: Peru
Mensajes: 486
Antigüedad: 13 años
Puntos: 9
Respuesta: visualizar llenado de campos

<?php
$state = false;
if ($_POST['action'] == "add") {
$conexion = mysql_connect("localhost", "mayito_luchito", "ninguna");
mysql_select_db("mayito_conta", $conexion);

$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;
}
?>

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

$queEmp = "SELECT * FROM empresa ORDER BY comprobante ASC";
$resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
$totEmp = mysql_num_rows($resEmp);
?>

<!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>.:: Ingreso de datos - CIS ::.</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>N° de Comprobante:
<input name="comprobante" type="text" id="comprobante" size="50" />
</p>
<?php
if ($totEmp> 0) {
while ($rowEmp = mysql_fetch_assoc($resEmp)) {
echo "Comprobante: ".$rowEmp['comprobante']."<br>";
}
}
?>
<p>RUC:
<input name="ruc" type="text" id="ruc" size="50" />
</p>
<p>Razon social:
<input name="razon" type="text" id="razon" size="50" />
</p>
<input type="submit" name="Submit" value="Insertar Registro" />
<input type="hidden" name="action" value="add" />
</form>

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