Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/03/2010, 10:07
dante14
 
Fecha de Ingreso: marzo-2009
Mensajes: 356
Antigüedad: 15 años, 1 mes
Puntos: 7
proceso para editar
es una pagina donde tiene los procesos
Código PHP:
    public function editarAction(){
        
        
$this->view->title "Editar Libro";
        
        
$this->view->headTitle($this->view->title'PREPEND');
        
        
$form = new Form_Libro();
        
        
$form->submit->setLabel('Guardar');
        
        
$this->view->form $form;

        if (
$this->getRequest()->isPost()) {

            
$formData $this->getRequest()->getPost();
            if (
$form->isValid($formData)) {
                
                
$id = (int)$form->getValue('id');
                
$autor $form->getValue('autor');
                
$titulo $form->getValue('titulo');
                
                
$libros = new Model_DbTable_Libros();
                
                
$libros->updateLibro($id$autor$titulo);
                
                
$this->_redirect('/');
            }else{
                
$form->populate($formData);
            }
        }else{
            
$id $this->_getParam('id'0);
            if (
$id 0) {
                
$albums = new Model_DbTable_Libros();
                
$form->populate($albums->getLibro($id));
            }
        }
    } 
esta es una pagina index.php que contiene el toolbar y la tabla
el toolbar
Código HTML:
 <table class="toolbar">
    <tr>
     <td class="button" id="toolbar-edit">
      <a href="<?php echo $this->url(array('controller'=>'libro','action'=>'editar'));?>"
         class="toolbar"><span class="icon-32-modificar"></span>Editar</a>
     </td>
    </tr>
   </table> 
Código HTML:
<table class="adminlist" cellpadding="1">
    <thead>
        <tr>
            <th width="2%" class="title">#</th>
            <th width="3%" class="title"><input type="checkbox" name="toggle" onclick="checkAll(20);" /></th>
            <th class="title">Autor</th>
            <th class="title">Titulo</th>
        </tr>
    </thead>
    <tbody>
    <?php
    $i = 0;
    foreach($this->libros as $libro) :
    $i = $i + 1;
    ?>
        <tr class="row0">
            <td><?php echo $i; ?></td>
            <td><input type="checkbox" id="cb<?php echo $i; ?>" name="cid[]"  value="<?php echo htmlentities($this->escape($libro->id)); ?>"
                       onclick="isChecked(this.checked);"/> </td>
            <td><?php echo htmlentities($this->escape($libro->titulo)) ;?></td>
            <td><?php echo htmlentities($this->escape($libro->autor)); ?></td>
            <td><?php echo htmlentities($this->escape($libro->id)); ?></td>
            <td>
                <a href="<?php echo $this->url(array('controller'=>'libro', 'action'=>'editar', 'id'=>$libro->id));?>">Editar</a>
                <a href="<?php echo $this->url(array('controller'=>'libro', 'action'=>'borrar', 'id'=>$libro->id));?>">Borrar</a>
            </td>
        </tr>
         <?php endforeach; ?>
   
</table> 
Lo que quisiera hacer es que al hacer clic en el check y dar clic en el boton editar salga en la pantalla los datos que se deben eliminar, lo loqre hacer pero siempre y cuando el editar este en cada fila de la tabla(pero lo malo es que es muy repetitivo)

como puedo solucionar el problema

como puedo amoldar el codigo para hacer lo que pedi amigos
gracias

Última edición por GatorV; 30/03/2010 a las 12:51