codeigniter - I cannot update by inserting details from a popup form -


when click insert link in second row passes id of first. first row updated.

my controller: money_c:

function addrow()     {         $this->load->view('header');         $this->load->view('manualupdate',$result);         $this->load->view('footer');     } 

my view page: manualupdate.php:

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>          </style>-->     <meta http-equiv="content-type" content="text/html; charset=utf-8" />     <title>popup contact form using css - demo | codingcrazy</title>     <link href="<?php echo base_url();?>assets/css/styleform.css" rel="stylesheet" type="text/css"/>     <link href='http://fonts.googleapis.com/css?family=electrolize' rel='stylesheet' type='text/css' />      <!--cc-->     <link rel="stylesheet" href="<?php echo base_url();?>assets/css/fonts.css"/>     </head>      <!--<link rel="stylesheet" href="<?php // echo base_url();?>assets/css/special.css" type="text/css" />-->     <div class="bal" style="margin-left: 627px;         padding: 15px;">      <table border="1">          <tr>                             <th>date</th>                    <th>description</th>                                   <th>category</th>                                   <th>debit</th>                                      <th>credit</th>                                         <th>bal.amt</th>                                            <th>insert</th>                                            <th> edit/delete</th></tr>                 <?php foreach($query2 $row)                {                     $date=$row->date;                    $desc=$row->description;                    $credit=$row->credit;                    $deb=$row->debit;                    $bal=$row->bal;                    $cat=$row->category;                    $id=$row->id;                ?>                      <tr><td><?php echo $date;?></td>             <td><?php echo $desc;?></td>             <td><?php echo $credit;?></td>             <td><?php echo $deb;?></td>             <td><?php echo $bal;?></td>             <td><?php echo $cat;?></td>             <td><a href="#pop" >insert<div id="pop" class="box">////here pop come////pop starts </tr>                     <?php                }                ?></table>          </tbody>     </table> 

popup:

<div class="smart-green">      <?php       echo         form_open('money_c/manualupdatesave/'.$id)?>              <label>             <span>date:</span>             <input type="date" name="dat"  />         </label>           <label>             <span>description:</span>             <input name="desc" type="text" />         </label>          <label>             <span>debit:</span>             <input type="text" name="deb"></input>         </label>           <label>             <span>credit:</span>             <input type="text" name="credit"></input>         </label>            <label>             <span>&nbsp;</span>             <input type="submit" style="margin-top:12px" class="button" style="background-color: #004e98;"value="send" />         </label>         </div>     <?php echo form_close();?>//////pop ends///////////     <!--</form>-->     <div id="close"> 

model: money_m:

    function transaction($a,$b,$c,$d,$e,$id)     {         $this->db->where('id',$id);         $this->db->set('date',$a);         $this->db->set('description',$b);         $this->db->set('debit',$d);         $this->db->set('credit',$e); //        $data=array('date'=>$a,'description'=>$b,'debit'=>$d,'credit'=>$e);          $this->db->update('manualupdate');      } 

in form_open('money_c/manualupdatesave/'.$id) first row id, not id of second row.

<a href="#pop" >insert<div id="pop" class="box"> 

change line

<a href="#pop-<?php echo $id;?>" >insert<div id="pop" class="box"> 

you popup code still not complete (assuming should this)

<div id="#pop-<?php echo $id;?>">  <?php          echo         form_open('money_c/manualupdatesave/'.$id)?>                <label>             <span>date:</span>             <input type="date" name="dat"  />         </label>           <label>             <span>description:</span>             <input name="desc" type="text" />         </label>           <label>             <span>debit:</span>             <input type="text" name="deb"></input>         </label>           <label>             <span>credit:</span>             <input type="text" name="credit"></input>         </label>            <label>             <span>&nbsp;</span>              <input type="submit" style="margin-top:12px" class="button" style="background-color: #004e98;"value="send" />          </label>           </div>     <?php echo form_close();?>//////pop ends///////////     <!--</form>-->     <div id="close"> 

Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -