Ver Mensaje Individual
  #4 (permalink)  
Antiguo 20/12/2011, 09:33
QuiqueGr
 
Fecha de Ingreso: enero-2008
Mensajes: 27
Antigüedad: 16 años, 3 meses
Puntos: 0
Respuesta: Error al pasar parámetro a una url

Hola jonatanlc y SetheR. Muchas gracias a ambos por vuestra rápida respuesta.

consultaHistorial.php:
Código HTML:
<?php
require('clases/historial.class.php');
$objHistorial=new Historial;
$consulta=$objHistorial->mostrar_historial_tarea($idtarea);
?>
<span id="nuevo"><a href="javascript:Carga('nuevoHistorial.php?id=<?php echo $idtarea ?>', 'formhistorial')"><img src="img/add.png" alt="Agregar actuacion" /></a></span>
<table>
    <tr>
        <th>Fecha</th>
        <th>Asunto</th>
        <th>Adjunto</th>
        <th></th>
        <th></th>
    </tr>
<?php
if($consulta) {
    while( $historial = mysql_fetch_array($consulta) ){
?>	
    <tr>
        <td><?php echo $historial['fecha'] ?></td>
        <td><?php echo $historial['asunto'] ?></td>
        <td><?php echo $historial['adjunto'] ?></td>
        <td><span class="modi"><a href="consultaTarea.php?id=<?php echo $historial['idHistorial'] ?>"><img src="img/database_edit.png" title="Editar" alt="Editar" /></a></span></td>
        <td><span class="dele"><a onClick="EliminarTarea(<?php echo $historial['idHistorial'] ?>); return false" href="eliminar.php?id=<?php echo $historial['idHistorial'] ?>"><img src="img/delete.png" title="Eliminar" alt="Eliminar" /></a></span></td>
    </tr>
<?php
    }
}
?>
</table> 

nuevoHistorial.php:
Código HTML:
<?php
require('functions.php');
if(isset($_POST['submit'])){
	require('clases/historial.class.php');
	$idtarea = htmlspecialchars(trim($_POST['hi_idtarea']));
	$fecha = htmlspecialchars(trim($_POST['hi_fecha']));
	$asunto = htmlspecialchars(trim($_POST['hi_asunto']));
	$adjunto = htmlspecialchars(trim($_POST['hi_adjunto']));
	$nombreFichero = "";
	$errorArchivo = false;
	if ($adjunto != ""){
            $nombreCarpeta = 'files/' .$idtarea;
            if (!is_dir($nombreCarpeta)) {
                mkdir($nombreCarpeta,0777);
            }
            $nombreFichero = 'files/' .$idtarea .'/' .$_FILES['hi_adjunto']['name'];
            if(is_uploaded_file($_FILES['hi_adjunto']['tmp_name'])) { 
                if(move_uploaded_file($_FILES['hi_adjunto']['tmp_name'], $nombreFichero)){      
                    $errorArchivo = false;
                }
                else
                    $errorArchivo = true;
            }
            else
            {
                $errorArchivo = true;
            }
        }
        if (!$errorArchivo){
            $objHistorial=new Historial;
            $fecha=$objHistorial->cambiarFecha($fecha);
            if ($objHistorial->insertar(array($idtarea,$fecha,$asunto,$nombreFichero)) == true){
                    echo 'Datos guardados';
            }else
                    echo 'Se produjo un error. Intente nuevamente';             
        }        
}
else
{
    if(isset($_GET['id'])){
?>
<form id="frmHistorialNuevo" name="frmHistorialNuevo" enctype="multipart/form-data" method="post" action="nuevoHistorial.php" onsubmit="GrabarHistorial(); return false">
  <input style="visibility:hidden" type="text" name="hi_idtarea" id="hi_idtarea" value="<?php echo $_GET['id']?>" visible="hidden" />
  <p>
    <label>Fecha 
        <input class="text" type="text" name="hi_fecha" id="hi_fecha" onBlur="javascript:return validarFecha('hi_fecha')" maxlength="10" value="<?php echo date("j-m-Y")?>" />
    </label>
  </p>
  <p>      
      <label>Asunto
        <input class="text" type="text" name="hi_asunto" id="hi_asunto" maxlength="50" />
      </label>
  </p>
  <p>      
      <label>Adjunto<br />
        <input type="file" name="hi_adjunto" id="hi_adjunto" maxlength="200" value="Examinar..." />
      </label>
  </p>
  <p>
    <input type="submit" name="submit" id="button" value="Enviar" />
    <label></label>
    <input type="button" class="cancelar" name="cancelar" id="cancelar" value="Cancelar" onclick="CancelarHistorial()" />
  </p>
</form>
<?php
    }
}
?> 
Gracias a los dos.
Un saludo.