Hi experts,
I'm using a php form to insert some fields in my database, on the form there are 7 fields, two of those are list/menu items, the problem is that these two items doesn't put the information I choose, it put "Resource id 3" insted.
here's my code, please help.
<?
session_start();
?>
<HTML>
<BODY bgcolor="#E6E6E6">
<?
//------------------------
----------
----------
----------
----
//Inicialización de variables.
$DBhost = "999.999.9.999";
$DBuser = "test";
$DBpass = "";
$DBName = "test";
$table = "documentos";
//------------------------
----------
----------
----------
----
$db = mysql_connect($DBhost,$DBu
ser,$DBpas
s) or die("No fué posible conectarse con la Base de Datos.");
//------------------------
----------
----------
----------
----------
----------
----------
-
@mysql_select_db("$DBName"
,$db) or die("Unable to select database $DBName");
@$sql = "SELECT username FROM users";
$usuario = mysql_query($sql);
//------------------------
----------
---------
@mysql_select_db("$DBName"
,$db) or die("Unable to select database $DBName");
@$sql = "SELECT departamento FROM deptos";
$departamento = mysql_query($sql);
//------------------------
----------
---------
//------------------------
----------
---------
@mysql_select_db("$DBName"
,$db) or die("Unable to select database $DBName");
@$sql = "SELECT tipo FROM tipo";
$tipo = mysql_query($sql);
//------------------------
----------
---------
//------------------------
----------
---------
@mysql_select_db("$DBName"
,$db) or die("Unable to select database $DBName");
@$sql = "SELECT perioricidad FROM perioricidad";
$perioricidad = mysql_query($sql);
//------------------------
----------
---------
?>
<br>
<html>
<body background="bgpie.jpg">
<div align="center">
<table width="60%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="32%" bgcolor="#42637B"> <div align="right"><font color="#ADCEE7">USUARIO:</
font></div
></td>
<td width="68%"> <? ECHO "$sess_nombre"; ?> </td>
</tr>
<tr>
<td width="32%" bgcolor="#42637B"> <div align="right"><font color="#B5D6EF">DEPARTAMEN
TO:</font>
</div>
<div align="right"></div></td>
<td width="68%"> <? echo "$sess_departamento"; ?> </td>
</tr>
</table>
</div>
<form action="<? echo $PHP_SELF ?>" method="post" enctype="multipart/form-da
ta" >
<table border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4"><div align="right"></div>
<div align="left"> </div></td>
</tr>
<tr>
<td width="150" height="10"><div align="right"><font size="3" face="Arial, Helvetica, sans-serif">Titular:</font
></div></t
d>
<td colspan="2"><font size="3" face="Arial, Helvetica, sans-serif">
<input name="titular" type="text" id="titular" size="75" maxlength="100">
</font>
<td>
</tr>
<tr>
<td width="150" height="10"><div align="right"><font size="3" face="Arial, Helvetica, sans-serif">Dirigido a: </font></div></td>
<td colspan="2"><font size="3" face="Arial, Helvetica, sans-serif">
<input name="dirigido" type="text" id="dirigido" size="75" maxlength="100">
</font>
<td>
</tr>
<tr>
<td width="150" height="10"><div align="right"><font size="3" face="Arial, Helvetica, sans-serif">Perioricidad:<
/font></di
v></td>
<td colspan="2"><font size="3" face="Arial, Helvetica, sans-serif">
<select name="perioricidad">
<? while ($row = mysql_fetch_array($periori
cidad)) { ?>
<option>
<? echo ($row["perioricidad"]); ?>
</option>
<? } ?>
</select>
</font>
<td width="0"></tr>
<tr>
<td width="150" height="3"><div align="right"><font size="3" face="Arial, Helvetica, sans-serif">Tipo:</font></
div></td>
<td colspan="2"><font size="3" face="Arial, Helvetica, sans-serif">
<select name="tipo">
<? while ($row = mysql_fetch_array($tipo)) { ?>
<option>
<? echo ($row["tipo"]); ?>
</option>
<? } ?>
</select>
</font></td>
<td width="0"></tr>
<tr>
<td width="150" height="3"><div align="right"><font size="3" face="Arial, Helvetica, sans-serif">Nombre de archivo: </font></div></td>
<td colspan="2"><font size="3" face="Arial, Helvetica, sans-serif">
<input name="nombre" type="text" id="nombre" size="75" maxlength="255">
</font></td>
<td>
</tr>
<tr>
<td width="150" height="31"><div align="right"><font size="3" face="Arial, Helvetica, sans-serif">Descripci&oacu
te;n:</fon
t></div></
td>
<td colspan="2"><font size="3" face="Arial, Helvetica, sans-serif">
<textarea name="descripcion" cols="57" id="descripcion"></textare
a>
</font></td>
<td width="0"></tr>
<tr>
<td width="150" height="20"><div align="right"><font size="3" face="Arial, Helvetica, sans-serif">Origen</font><
/div></td>
<td width="524"><font size="3" face="Arial, Helvetica, sans-serif">
<input name="origen" type="file" id="origen" size="75" maxlength="255">
</font></td>
<td width="115"><font size="3" face="Arial, Helvetica, sans-serif"> </font><
/td>
<td width="0"></tr>
<tr>
<td width="150" height="22"><div align="right"><font face="Arial, Helvetica, sans-serif"><font size="3"><font face="Arial, Helvetica, sans-serif"><font size="3"></font></font></f
ont></font
></div></t
d>
<td colspan="2"><font size="3" face="Arial, Helvetica, sans-serif"> </font><
/td>
<td width="0" rowspan="2">
</tr>
<tr>
<td height="26" colspan="3"> <div align="center">
<font size="3" face="Arial, Helvetica, sans-serif">
<input name="submit" type="submit" value="BUBIR ARCHIVO">
</font></div></td>
</tr>
</table>
</form>
<?php
if (@$submit) {
//------------------------
----------
----------
----------
----------
----------
----------
-
//Calcula el valor de la Fecha
$today = getdate (time());
$day = $today[ "mday"];
$month = $today["mon"];
$year = $today["year"];
$hour = $today["hours"];
$minutes = $today["minutes"];
$seconds = $today["seconds"];
$fecha = "$year-$month-$day";
//------------------------
----------
----------
----------
----------
----------
----------
-
//abre una sesion en la base de datos
$db = mysql_connect($DBhost,$DBu
ser,$DBpas
s) or die("No fué posible conectarse con la Base de Datos.");
//------------------------
----------
----------
----------
----------
----------
----------
-
//------------------------
----------
----------
----------
----------
----------
----------
-
//inserta los valores en la base de datos
@mysql_select_db("$DBName"
,$db) or die("Unable to select database $DBName");
$sql1 = "INSERT INTO $table (usuario,departamento,titu
lar,dirigi
do,periori
cidad,tipo
,nombre,de
scripcion,
rutaorigen
,fecha) VALUES ('$usuario','$departamento
','$titula
r','$dirig
ido','$per
ioricidad'
,'$tipo','
$nombre','
$descripci
on','$orig
en','$fech
a')";
$result1 = mysql_query($sql1);
//------------------------
----------
----------
----------
----------
----------
----------
-
//Este Código se ejecuta si se realizaron modificaciones a la DB
echo('<div align="center"><h3>El Archivo Subió Exitosamente.</h3></div>')
;
Thank you guys.
Start Free Trial