File: /home/asjudine/www/formulario_guia_correos3.php
<?php
require_once("mainfile.php");
include ("config.php");
require_once("Conectarse.php");
global $dbi;
$Recordset2 = mysql_query('SELECT * FROM sucursal WHERE codigo!="**" order by nombre');
if (!$Recordset2) {
die('Invalid query: ' . mysql_error());
}
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>
<html>
<head>
<title>Registro de Formulario Juridico</title>
<style type="text/css">
<!--
img {border: 0}
body,td {font-family: Verdana,Arial; font-size: 8pt; color: #000000}
input,select {font-family: Verdana,Arial; font-size: 7.5pt}
a:link, a:visited {text-decoration: none; color: #2030F0}
a:hover, a:active {text-decoration: underline; color: #D02010}
body table tr td table tr td form table {
font-size: 14px;
font-family: Georgia, "Times New Roman", Times, serif;
}
body table tr td table tr td form table tr td div strong {
font-size: 10pt;
}
body table tr td table tr td form table tr td div strong {
font-size: 9pt;
}
body table tr td table tr td form table tr td b {
font-size: 9pt;
}
body table tr td table tr td form table tr td div {
font-size: 7pt;
}
body {
background-image: url(ELEMENTOS/gri06.jpg );
}
.polici {background-color: #FFCC66; font-size: 14px; font-family: Arial; color: #000099; width:10px display: block;}
.policia2 {background-color: #FFFFFF; font-size: 14px; font-family: Arial; color: #000099; width:10px display: block;}
.Estilo1 {font: 14px; color: #3366FF; font-family: Arial; font-weight: bold; }
-->
</style>
<script>
function Verificar() {
if(document.frm.funcionario.value == "") {
alert("Por Favor Seleccione Funcionario");
document.frm.funcionario.focus();
return false;
}
if(document.frm.nombre.value == "") {
alert("Por Favor Escriba El Nombre");
document.frm.nombre.focus();
return false;
}
return true;
}
</script>
</head>
<body bgcolor="#EFEFEF" text="#000000" topmargin="0" leftmargin="0">
<br>
<center> <img src="ELEMENTOS\CABEZOTE SERVIASJUDINET.jpg" WIDTH=60% > </center>
<br>
<tr>
<td height="11" valign="top">
<table width="70%" border="0" cellspacing="0" cellpadding="0">
</table>
</td>
</tr>
<tr>
<td align="center">
<table width="777" height="343" border="5" align="center" bgcolor="#EFEFEF">
<tr>
<td align="center" bgcolor="#2E7068"><big style="color:#FFFFFF"><b>INGRESAR GUIA DE CORREO</b></big></td>
</tr>
<tr>
<td height="321" colspan="2" align="center">
<script>
function Verificar() {
if(document.frm.funcionario.value == "") {
alert("Por Favor Seleccione El Funcionario");
document.frm.funcionario.focus();
return false;
}
if(document.frm.sucursal.value == "") {
alert("Por Favor Seleccione La Sucursal");
document.frm.sucursal.focus();
return false;
}
if(document.frm.fecha.value == "0000-00-00") {
alert("Por Favor Escriba La Fecha");
document.frm.fecha.focus();
return false;
}
if(document.frm.kilometros.value == "") {
alert("Por Favor Escriba Los Kilometros De Recorrido");
document.frm.kilometros.focus();
return false;
}
if(document.frm.galones.value == "") {
alert("Por Favor Escriba Los Galones");
document.frm.galones.focus();
return false;
}
if(document.frm.contratos.value == "") {
alert("Por Favor Escriba Los Contratos");
document.frm.contratos.focus();
return false;
}
if(document.frm.municipios.value == "") {
alert("Por Favor Escriba Los Municipios");
document.frm.municipios.focus();
return false;
}
if(document.frm.novedades.value == "") {
alert("Por Favor Escriba Las Novedades");
document.frm.novedades.focus();
return false;
}
return true;
}
</script>
<form method="post" name="frm" onSubmit="return Verificar()">
<table width="775" border="7" cellpadding="2" cellspacing="5" bgcolor="#EFEFEF" >
<tr>
<td align="right"><b>Guia Numero:</b></td>
<td><input type="text" name="guia" value=""size="30"></td>
<td align="right"><b>Fecha Guia:</b></td>
<td><input type="text" name="fecha" value="0000-00-00"size="20"></td>
</tr>
<tr>
<td align="right"><b>Apellidos Destinatario:</b></td>
<td><input type="text" name="apellidos" value=""size="40"></td>
<td align="right"><b>Nombres Destinatario:</b></td>
<td><input type="text" name="nombres" value=""size="40"></td>
</tr>
<tr>
<td align="right"><b>Empresa Transportadora:</b></td>
<td><input type="text" name="transportadora" value=""size="40"></td>
<td align="right"><b>Direccion Envio:</b></td>
<td><input type="text" name="direccion" value=""size="50"></td>
</tr>
<tr>
<td align="right"><b>Ciudad Envio:</b></td>
<td><input type="text" name="ciudad" value=""size="30"></td>
<td width="121" align="right"><b>Sucursal:</b></td>
<td width="225"><SELECT NAME="sucursal">
<OPTION value="">--Nombre Sucursal--</OPTION>
<?php
do {
?>
<option value="<?php echo $row_Recordset2['codigo']?>"><?php echo $row_Recordset2['nombre']?></option>
<?php
} while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));
$rows = mysql_num_rows($Recordset2);
if($rows > 0) {
mysql_data_seek($Recordset2, 0);
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
}
?>
</SELECT>
</td>
</tr>
<tr >
<td align="right" bgcolor="#EFEFEF"><b>Adjuntar archivo del Contrato:
</b></td>
<td bgcolor="#EFEFEF" ><input name="archivito" type="file" size="30" maxlength="40"></td>
<td align="right" bgcolor="#EFEFEF"><b>Novedades:</b></td>
<td bgcolor="#EFEFEF"><textarea name="novedades" cols="30" rows="5"></textarea></td>
</tr>
</table>
<br>
<input name="guardar" type="submit" class="polici" id="guardar" value="Guardar Informacion" />
</form>
</td>
</tr>
</table><br>
</td>
</tr>
<td height="15" colspan="2" bgcolor="#EFEFEF" class="fecha"><div align="center">
<input name="menu2" type="button" class="Estilo1" id="menu2" onClick="window.location.href='menu_recorridos.php'" value="REGRESAR AL MENU">
</div></td>
</body>
</html>
<?PHP extract($_POST,EXTR_SKIP); ?>
<?
if(isset($_POST["guardar"]))
{
$archivo = $_FILES["archivito"]["tmp_name"];
$tamanio = $_FILES["archivito"]["size"];
$tipo = $_FILES["archivito"]["type"];
$nombre = $_FILES["archivito"]["name"];
$fp = fopen($archivo, "rb");
$contenido = fread($fp, $tamanio);
$contenido = addslashes($contenido);
fclose($fp);
$csqle1 = mysql_query("INSERT INTO guia_correos (fecha_envio,numero_guia,empresa_transportadora,apellidos,
nombres,direccion_envio,ciudad_envio,nombre,contenido,tipo,novedades,sucursal) VALUES ('".$_POST[fecha]."','".$_POST[guia]."','".$_POST[transportadora]."','".$_POST[apellidos]."','".$_POST[direccion]."','".$_POST[direccion]."','".$_POST[ciudad]."','".$nombre."','".$contenido."','".$tipo."','".$_POST[novedades]."', '".$_POST[sucursal]."')");
if (!$csqle1) { // esto es para que aparescan los errores
die('Invalid query csql: ' . mysql_error());
}
echo "<script>alert('Los datos fueron Guardados');</script>";
}
?>