http://foros.cristalab.com/posting.php?mode=newtopic&f=18#
me sale este notice
Notice: Undefined index: imagen1 in E:\Archivos de programa\EasyPHP-5.3.1\www\argentina\gestion\nuevoregistro2.php on line 44
La imagen 24oobgm.jpg fue correctamente cargada!La columna 'imagen' no puede ser nula
les dejo el codigo muchas gracias
<?php require_once('../Connections/argentina.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"] == "formulario")) {
$insertSQL = sprintf("INSERT INTO obras1 (titulo, subtitulo, imagen, texto, fecha, descripcion) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['textfield'], "text"),
GetSQLValueString($_POST['textfield2'], "text"),
GetSQLValueString($_POST['imagen1'], "text"),
GetSQLValueString($_POST['textarea'], "text"),
GetSQLValueString($_POST['textfield3'], "date"),
GetSQLValueString($_POST['textarea2'], "text"));
if (is_uploaded_file($_FILES['imagen1']['tmp_name'])) {
move_uploaded_file($_FILES['imagen1']['tmp_name'], "../fotos/" . $_FILES['imagen1']['name']);
echo 'La imagen '; echo $_FILES['imagen1']['name']. ' fue correctamente cargada!';
}
mysql_select_db($database_argentina, $argentina);
$Result1 = mysql_query($insertSQL, $argentina) or die(mysql_error());
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin título</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #00446C;
}
.Estilo1 { font-size: 18px;
font-weight: bold;
}
.estilotextarea {width:400px;height:100px;border: 2px solid ;}
.estilotextarea2 {width:400px;height:20px;border: 2px solid ;}
-->
</style></head>
<body>
<div align="center">
<p><img src="../argtrab.png" width="745" height="266">
</p>
<p> </p>
<form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="formulario" id="formulario">
<p> </p>
<p> </p>
<p> </p>
<table width="448" border="1">
<tr>
<td width="92"> </td>
<td width="340"><input type="text" name="textfield"></td>
</tr>
<tr>
<td> </td>
<td><input type="text" name="textfield2"></td>
</tr>
<tr>
<td> </td>
<td><textarea name="textarea"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input name="imagen1" type="file" id="imagen1"></td>
</tr>
<tr>
<td> </td>
<td><textarea name="textarea2"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input name="textfield3" type="text" id="textfield3"></td>
</tr>
</table>
<p>
<input type="submit" name="Submit" value="Enviar">
</p>
<input type="hidden" name="MM_insert" value="formulario">
</form>
<p> </p>
<p> </p>
</div>
</body>
</html>