este es el script del formulario donde subo la imagen y otros datos
articulos.php
Código PHP:
<?php require_once('../Connections/ofertas.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO contenido (id_articulos, Nombre, Articulos, Imagen, Precio, Descuento, Ahorras, Hora, Minutos, Segundos, empresa) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['id_articulos'], "int"),
GetSQLValueString($_POST['Nombre'], "text"),
GetSQLValueString($_POST['Articulos'], "text"),
GetSQLValueString($_POST['Imagen'], "text"),
GetSQLValueString($_POST['Precio'], "text"),
GetSQLValueString($_POST['Descuento'], "text"),
GetSQLValueString($_POST['Ahorras'], "text"),
GetSQLValueString($_POST['Hora'], "date"),
GetSQLValueString($_POST['Minutos'], "date"),
GetSQLValueString($_POST['Segundos'], "date"),
GetSQLValueString($_POST['empresa'], "text"));
mysql_select_db($database_ofertas, $ofertas);
$Result1 = mysql_query($insertSQL, $ofertas) or die(mysql_error());
$insertGoTo = "articulo.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?><!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></title>
<style type="text/css">
<!--
#articulos {
position:absolute;
left:58px;
top:38px;
width:600px;
height:600px;
z-index:1;
}
-->
</style>
</head>
<body>
<div id="articulos">
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Nombre:</td>
<td><input type="text" name="Nombre" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right" valign="top">Articulos:</td>
<td><textarea name="Articulos" cols="50" rows="5"></textarea>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Imagen:</td>
<td><input name="Imagen" type="file" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Precio:</td>
<td><input type="text" name="Precio" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Descuento:</td>
<td><input type="text" name="Descuento" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Ahorras:</td>
<td><input type="text" name="Ahorras" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Hora:</td>
<td><input type="text" name="Hora" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Minutos:</td>
<td><input type="text" name="Minutos" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Segundos:</td>
<td><input type="text" name="Segundos" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Empresa:</td>
<td><input type="text" name="empresa" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Insertar registro"></td>
</tr>
</table>
<input type="hidden" name="id_articulos" value="">
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
</div>
</body>
</html>
articulo.php
Código PHP:
<?php require_once('../Connections/ofertas.php'); ?>
<?php
mysql_select_db($database_ofertas, $ofertas);
$query_articulo = "SELECT Nombre, Articulos, Imagen, Precio, Descuento, Ahorras, Hora, Minutos, Segundos, empresa FROM contenido";
$articulo = mysql_query($query_articulo, $ofertas) or die(mysql_error());
$row_articulo = mysql_fetch_assoc($articulo);
$totalRows_articulo = mysql_num_rows($articulo);
?><!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></title>
<style type="text/css">
<!--
.Estilo1 {
font-family: "Times New Roman", Times, serif;
font-weight: bold;
font-size: 44px;
color: #0066FF;
}
-->
</style>
</head>
<body>
<div id="articulo">
<table width="533" border="0" align="center">
<tr>
<td width="129"> </td>
<td width="394"><span class="Estilo1"><?php echo $row_articulo['Nombre']; ?></span></td>
</tr>
<tr>
<td><?php echo $row_articulo['Precio']; ?> <?php echo $row_articulo['Descuento']; ?> <?php echo $row_articulo['Ahorras']; ?></td>
<td><p><?php echo $row_articulo['Imagen ']; ?>
<p><?php echo $row_articulo['Articulos']; ?></p></td>
</tr>
<tr>
<td><?php echo $row_articulo['Hora']; ?></td>
<td><?php echo $row_articulo['empresa']; ?></td>
</tr>
</table>
</div>
</body>
</html>
<?php
mysql_free_result($articulo);
?>
muchisimas gracias
![Porras](http://static.forosdelweb.com/fdwtheme/images/smilies/porra.gif)
![Porras](http://static.forosdelweb.com/fdwtheme/images/smilies/porra.gif)
![Porras](http://static.forosdelweb.com/fdwtheme/images/smilies/porra.gif)