PHP - Ayuda! problemas con actualizacion de formulario

 
Vista:

Ayuda! problemas con actualizacion de formulario

Publicado por Luthien (24 intervenciones) el 13/12/2007 16:59:37
hola a todos.
Tengo un problema con un formulario que no me actualiza y estoy como loca desde hace varios dias sin detectar que puede pasar. Ojala puedan ayudarme!
La pagina incluye un archivo cls que es el siguiente y la pagina modificainforme.php que es donde tengo desarollado todo el codigo.

Por favor estoy deseperada!

clsInformes.cls

<?php
require_once("clsMysql.cls");

class clsNoticia extends clsMysql
{
var $Idiomas;
var $max;
var $numeroidiomas;

function clsNoticia()
{
$this->clsMysql("f,"","","");
$this->conectar();
}

function lista()
{
$sql="SELECT * FROM informes";
$this->consulta($sql);

return $this->toarray();
}
function consultaporid($id)
{
$sql="SELECT * FROM informes WHERE id=$id";
$this->consulta($sql);
$ret=$this->toarray();
return $ret[0];

}

function crea()
{
$sql="INSERT INTO informes (texto) VALUES ('nova')";
$this->consulta($sql);
$max=$this->maximoid("id","informes");
//echo $sql;

return $max;
}

function actualizar($id,$valores)
{
$sql="UPDATE informes
SET texto='".$valores["texto"]."',foto='".$valores["foto"]."' WHERE id=$id";
$this->consulta($sql);
//print $sql;
}

function eliminar($id)
{
$sql="SELECT foto FROM informes WHERE id=$id";
$this->consulta($sql);
$imagen=$this->toarray();
$sql="DELETE FROM informes WHERE id=$id";
$this->consulta($sql);
@chmod($image[0]->foto,0777);
@unlink($image[0]->foto);
$grande=str_replace($image[0]->foto,"tb",'');
@chmod($grande,0777);
@unlink($grande);


}



}

?>


modificainforme.php
<?php
include_once('clases/clsInformes.cls');
$noticias=new clsNoticia;

if(isset($_REQUEST["texto"])&&isset($_REQUEST["Modificar"]))
{
$max=$_REQUEST["id"];

$origen=$HTTP_POST_FILES['archivo']['name'];
$tmp_origen=$HTTP_POST_FILES['archivo']['tmp_name'];
$tipo_imagen=$HTTP_POST_FILES['archivo']['type'];

$destino='img';
$resx=200;
$resy=200;
$id=$max;
if((is_uploaded_file($tmp_origen)) && (strpos($tipo_imagen, "jpeg")))//si se upload bien y es .jpg
{

$nombre_archivo="noticia".$id.".jpg";
$nombre_archivot=$destino."/tbcampanya".$id.".jpg";


@move_uploaded_file($tmp_origen,$destino."/".$nombre_archivo);
$image_path=$destino."/".$nombre_archivo;
$img = null;

$ext = strtolower(end(explode('.', $image_path)));
if ($ext == 'jpg' || $ext == 'jpeg')
{
$img = @ImageCreateFromJPEG($image_path);
}

if ($img)
{
# Get image size and scale ratio
$width = imagesx($img);
$height = imagesy($img);
$scale = min($resx/$width, $resy/$height);

if ($scale < 1)
{
$new_width = floor($scale*$width);
$new_height = floor($scale*$height);

}
else
{
$scale=1;
$new_width = floor($scale*$width);
$new_height = floor($scale*$height);

}
$tmp_img = ImageCreateTrueColor($new_width, $new_height);
ImageCopyResized($tmp_img, $img, 0, 0, 0, 0,$new_width, $new_height, $width, $height);
ImageJPEG($tmp_img,$nombre_archivot,100);
}


$valores=array("texto"=>addslashes($_REQUEST["texto"]),"foto"=>$nombre_archivot);
$noticias->actualizar($_REQUEST["id"],$valores);
echo"<script>window.location='informes.php'</script>";
}
}
elseif(isset($_REQUEST["Cancelar"]))
echo"<script>window.location='informes.php'</script>";
else
{
$datos=$noticias->consultaporid($_REQUEST["id"]);

$id=$_REQUEST["id"];
$texto=$datos->texto;
$foto=$datos->foto;



}
?>
<html><head><title></title>
<script language="JavaScript" type="text/javascript" src="funciones.js"></script>
<LINK REL="stylesheet" HREF="estilo/estilo.css" TYPE="TEXT/CSS">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body leftmargin="0" topmargin="0" >
<table align="center" border="0" cellpadding="0" cellspacing="0" width="789">
<tr>
<td><p> </p>
<p><img src="../img/logo.jpg" width="75" height="91"></p>
<p> </p></td>
</tr>
<tr>
<td height="21" bgcolor="#666666"><span class="txtNormal_blanco"><strong>>Modifica informes </strong></span></td>
</tr>
<tr>
<td><img src="imagenes/pixel.gif" width="1" height="5" border="0" alt=""></td>
</tr>
<tr>
<td valign="top">
<form name="frmSocios" action="modificainforme.php" method="post" enctype="multipart/form-data">
<table cellspacing="2" cellpadding="4" style="border:1px solid #666666;" width="100%">
<tr>
<td valign="top" class="txtNormal_negro" colspan="2"><input type="hidden" name="id" value="<?php echo $id?>">
<b>Nom de l'informe :<b><br> <textarea class="txtNormal_negro" name="texto" cols="120" rows="6"><?php echo $texto?></textarea></td>
</tr>
<tr><? if ($foto!='') {?>
<td class="txtNormal_negro" valign="top" width="30%"><img src="<?php echo $foto?>" id="imgnoticia" name="imgnoticia"></td>
<?} else {?>
<td class="txtNormal_negro" valign="top" width="30%"> </td>
<?}?>
<td class="txtNormal_negro" valign="top">Arxiu:
<input class="txtNormal_negro" name="archivo" type="file"></td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit" value="Modificar" name="Modificar"> <input type="submit" value="Cancel·lar" name="Cancelar"></td>
</tr>
</table>
</form>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder