hola a todos yo tengo un formulario en que hay checkbox creados por una consulta mysql, y necesito insertar en mysql los checkbox seleccionados, listo me inserta solo un checkbox y cuando quiero incorporar los demas checkbos se me presenta el siguiente error
ERROR
Warning: implode() [function.implode]: Bad arguments. in C:\AppServ\www\InsertarArchivo.php on line 23
Warning: implode() [function.implode]: Bad arguments. in C:\AppServ\www\InsertarArchivo.php on line 25
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '),())' at line 1
este es mi formulario de logica
InsertarArchivo.php
Código PHP:
Ver original<DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML 1.0 Strict / / EN" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
<link type="text/css" rel="stylesheet" href="estilo.css">
<?php
if ((isset($_POST['codigo']) && isset($_POST['nombre']) && isset($_POST['version']) && isset($_POST['Area']))
&& ($_POST['codigo'] != "" || $_POST['nombre'] != "" || $_POST['version'] != "" || $_POST['Area'] != "" )) {
$Codigo=$_POST['codigo'];
$Nombre=$_POST['nombre'];
$Version=$_POST['version'];
$Area2=implode(",",$_POST['Area2']);
$Area3=implode(",",$_POST['Area3']);
$destino='archivos';
$nom_archivo = $_FILES['archivo']['name'];
$tipo = $_FILES['archivo']['type'];
$size = $_FILES['archivo']['size'];
$tamano=$_FILES['file']['size'];
if($tamano < 500){
copy($_FILES['archivo']['tmp_name'], $destino.'/'.$_FILES['archivo']['name']);
require("Conexion.php");
$sql = "insert into `datos` (`Codigo`,`Nombre`,`Version`,`Adjunto`,`Area`,`Area2`,`Area3`) values('{$Codigo}','{$Nombre}','{$Version}','{$_FILES['archivo']['name']}', (".$Area."),(".$Area2."),(".$Area3."))";
echo "<pre>";
echo "</pre>";
echo '<center><b><h3>Se insertaron los datos correctamente</a></h3></b></center>';
echo '<center><b><h3><a href=CargarDocumento.php> Regresar </a></h3></b></center>';
}else {
echo ("El tamaño es superior al permitido");
}
}else {
$sindatos = "<center><font color=\"red\" size=\"4\"><b>DEBE INGRESAR DATOS<b></font></center>";
include('CargarDocumento.php');
}
CargarDocumento.php ----> el formulario de presentacion
Código HTML:
Ver original<DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML 1.0 Strict / / EN" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
<script language="JavaScript" type="text/javascript" src="js/Ajax.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
<link type="text/css" rel="stylesheet" href="estilo.css">
<div style="text-align: right;"><a href="CerrarSecion.php"><h6>Cerrar Sesion
</h6></a></div>
<center><?php if (isset($sindatos)) echo $sindatos; ?></center>
<center><h2>CARGA DEL DOCUMENTO
</h2><center>
<h3>Aqui usted podra ingresar nuevos documentos, pero estos solo pueden ser subidos cuando ya esten aprobados previamente,
<br>
los campos con un
<font color="red"><b>*
</b></font> son obligatorios, debe seleccionar las areas que pueden ver los documentos a leer.
</h3>
<form action="InsertarArchivo.php" method="post" enctype="multipart/form-data" name="form1">
<center><a href="MenuAdmi.php"><h3> Devlover
</h3></a></center>
<center><IMG SRC="imagenes/LOGO.jpg" WIDTH=120 HEIGHT=100></center>
<h3><center>DATOS DEL DOCUMENTO
</center></h3>
<center><h4><font color="red"><b>*
</b></font> Codigo del Documento:
<input type="text" name="codigo" id="documento" size="27" value="<?php if(isset($Codigo)) echo $Codigo?>"/>
</h4></center>
<center><h4><font color="red"><b>*
</b></font> Nombre del Documento:
<input type="text" name="nombre" id="nombre" size="25" value="<?php if(isset($Nombre)) echo $Nombre?>" />
</h4></center><?php if (isset($novalnum1)) echo $novalnum1?>
<center><h4><font color="red"><b>*
</b></font> Version del Documento:
<input type="text" name="version" id="version" size="26" value="<?php if(isset($Version)) echo $Version?>" />
</h4></center><?php if (isset($novalnum2)) echo $novalnum2?>
<p align="center"><h4><font color="red"><b>*
</b></font> Archivo
<input name="archivo" type="file" id="archivo"> </h4>
<h4><font color="red"><b>*
</b></font> Area Correspondiente:
<br><br><?php
require("Conexion.php");
$resultado=mysql_query("Select * from `area`");
while ($row = mysql_fetch_array($resultado)){
echo "<input type=\"checkbox\" name=\"Area[]\" value=\"".$row['Cod.Area']."\">".$row['Nombre_Area']."
<br>";
}
?>
<center><p align="center"><input name="boton" type="submit" id="boton" value="ENVIAR"> <input name="boton" type="reset" id="boton" value="LIMPIAR"></p></center>
agradesco toda la ayuda posible