Wie 'pass verketteten Parameter als einzigen parameter, und füllen Sie die Seite anzeigen'?

Ich habe versucht und bekam Hilfe von stack-overflow-Art-team-Mitglied und erreicht bis zu dieser Ebene, noch ich haben zu gehen Schritt näher, um es zu lösen .Jedoch, wenn Ich bin versucht, übergeben Sie parameter, die verkettet ist, Beispiel ich pass parameter wie l/59. Sobald dieser parameter übergeben wird, sollte es abrufen von relevanten Daten aus der Tabelle mit dem Namen st_dak_details , und ich möchte die Daten aus der Tabelle zu füllen, es in einer anderen Seite anzeigen . Aber es funktioniert nicht, also nicht immer aufgefüllt.

**first view page where I pass parameter**

<div class="col-sm-7 col-md-6 col-lg-4">
                <button type="reset" class="btn btn-default" >Reset <span class="glyphicon glyphicon-refresh"></span></button>
                <button type="button" class="btn btn-success" id="getbtn" onclick="loadPagcontente('<?php echo site_url()?>/UsermanagementController/forwardtrack')" >Get Detais <span class="glyphicon glyphicon-ok"></span></button>
~~
                <!-- <button type="button" class="btn btn-success" id="getbtn" onclick="loadPagcontente('<?php //echo site_url()?>/UsermanagementController/forwardtrack')">Get Detais <span class="glyphicon glyphicon-ok"></span></button> -->
            </div>

~
 **Inside Controller**
~
function forwardtrack($param='',$param2='') {
if(sizeof($this->db->get_where('st_forward',array('letter_no' =>$param.'/'.$param2))->result_array())>0 && (!($param.'/'.$param2) )){
    $data1['message']= 'notallow';
    $this->load->view('track1',$data1);
}
else{
    $data1['name']=$this->db->get_where('bpas_user_profiles',array('AgencyMainParentID' =>$this->session->userdata('ministryId'),'AgencyParentID'=>$this->session->userdata('parentID'),'AgencyID'=>$this->session->userdata('agencyID')))->result_array();

$data1['userdeatils']=$this->ag->tracks($param.'/'.$param2); 
$this->load->view('userManagement/forward2', $data1);
}

   /* ag=> agency model */


}

**Inside model**
public function tracks($letterno="")
    {   



     $query= $this->db->get_where('st_dak_details',array('dakLetterNo'=>$letterno));
      if ($query->num_rows() > 0) {
            return $query->row();
      } else {
            return array();
      }




    }

**Inside  final view page**
~
<div class="container">
    <div class="panel panel-info">
        <div class="panel-heading">
            <i class="fa fa-envelope-o fa-fw"></i>forward to
        </div>
        <div class="panel-body">
            <form class="form-horizontal" enctype="multipart/form-data" action="#" method="post" id="forwardmessage">


                <div class="form-group">
                   <label  for="letter"class="col-xs-12 col-lg-1 col-sm-1 col-md-1">letter_no: </label>
                   <div class="input-group">
                     <span class="input-group-addon"><i class="glyphicon glyphicon-credit-card"></i></span>

                    <?php  if(!empty($userdeatils)){
               foreach($userdeatils as $row) { ?>
   <!--  your html code -->

                     <input name="dakLetterNo" id="dakLetterNo" value="<?php echo $row['dakLetterNo'];?>"readonly="true" class="form-control" type="text" required />
                   </div>



                </div>




                <!-- <div class="form-group">
                   <label class="col-xs-12 col-lg-2 col-sm-2 col-md-2">created: </label>
                   <div class="input-group">
                     <span class="input-group-addon"><i class="glyphicon glyphicon-credit-card"></i></span>
                     <input name="copy_to" id="copy_to" value="<?php //echo $userdeatils->created;?>"readonly="true" class="form-control" type="text" required />
                   </div>   -->

                   <div class="form-group">

                   <label class="col-xs-12 col-lg-2 col-sm-2 col-md-2 control-label">Attachment: </label>
                   <div class="col-xs-12 col-lg-10 col-sm-10 col-md-10"> 
                        <input type="file" name="Attachment" id="Attachment">
                   </div>    
                </div>


                <div class="form-group">
                   <label class="col-xs-12 col-lg-2 col-sm-2 col-md-2">Subject: </label>
                      <div class="input-group" class="col-xs-12 col-lg-10 col-sm-10 col-md-10">
                        <span class="input-group-addon" id="subjecterr"><i class="glyphicon glyphicon-credit-card"></i></span>
                     <input name="subject" id="Remark" value="<?php echo $row['Remark'];?>"readonly="true" class="form-control" type="text" required />   

                     </div>          
                </div>
                <div class="form-group">

                   <label class="col-xs-12 col-lg-2 col-sm-2 col-md-2">Place: </label>
                     <div class="input-group" class="col-xs-12 col-lg-10 col-sm-10 col-md-10">
                   <span class="input-group-addon"><i class="glyphicon glyphicon-credit-card"></i></span>
                     <input name="place" id="place" value="<?php echo $row['place'];?>"readonly="true" class="form-control" type="text" required />  
                    </div>


                </div>
                <div class="form-group">

                   <label class="col-xs-12 col-lg-2 col-sm-2 col-md-2">from: </label>
                   <div class="input-group" class="col-xs-12 col-lg-10 col-sm-10 col-md-10">
                     <span class="input-group-addon"><i class="glyphicon glyphicon-credit-card"></i></span>
                     <input name="from" id="receieve_add" value="<?php echo $row['receieve_add'];?>"readonly="true" class="form-control" type="text" required />
                  </div>

                </div>

                <div class="form-group">


                     <label class="col-xs-12 col-lg-2 col-sm-2 col-md-2">Created: </label>
                   <div class="input-group" class="col-xs-12 col-lg-10 col-sm-10 col-md-10">
                     <span class="input-group-addon"><i class="glyphicon glyphicon-credit-card"></i></span>
                     <input name="created" id="created" value="<?php echo $row['created'];?>"readonly="true" class="form-control" type="text" required />
                   </div>
               </div>

                <!-- </div> -->

                <!-- <div class="form-group"> -->


                     <!-- <label class="col-xs-12 col-lg-2 col-sm-2 col-md-2">Message: </label> -->
                   <!-- <div class="input-group" class="col-xs-12 col-lg-10 col-sm-10 col-md-10"> -->
                     <!-- <span class="input-group-addon"><i class="glyphicon glyphicon-credit-card"></i></span> -->
                     <!-- <input name="message" id="message" value="<?php //echo $userdeatils->created;?>"readonly="true" class="form-control" type="text" required /> -->
                   <!-- </div> -->

                <!-- </div> -->
                 <?php } ?>  <!-- //foreach close -->
                 <?php } ?>  <!-- //if close -->

                <div class="form-group">
                   <label class="col-lg-2 col-xs-12 col-sm-2 col-md-2">Message: </label>
                   <div class="col-xs-12 col-lg-10 col-sm-10 col-md-10"> 
                        <textarea class="form-control" id="message" name="message"></textarea>
                        <span id="messageerr" class="text-danger"></span>
                   </div>    
                </div>

                <div class="form-group">
                    <label class="col-lg-2 col-xs-12 col-sm-2 col-md-2">
                        Forward to
                    </label>
                    <div class="col-lg-6 col-xs-12 col-sm-6 col-md-6">
                        <select name="forwardto[]" id="agency" class="form-control">
                            <option value="">Select</option>
                           <?php 
                           foreach($name as $row):  ?>
                              <option value="<?php echo $row['cid']?>">
                                <?php echo $row['FirstName'].$row['MiddleName'].$row['LastName']?>
                              </option>
                            <?php endforeach;?>
                        </select> 
                        <span id="forwarderr" class="text-danger"></span>
                    </div>
                    <div class="col-lg-4 col-xs-12 col-sm-4 col-md-4">
                        <button type="button" onclick="addmessageto()" class="btn btn-success">Add More</button>
                         <button type="button" onclick="removemessageto()" class="btn btn-warning">Remove</button>
                    </div>
                </div>
                <span id="addmoreforwardto"></span>
                <hr />
                <div class="form-group">
                   <div class="col-xs-12 col-lg-10 col-sm-12 col-md-12"> 
                     <button type="button" class="btn btn-info" onclick="forwardmessage('forward')"> <i class="fa fa-send"></i> &nbsp;&nbsp;&nbsp;Forward to</button>

                     <button type="button" class="btn btn-info" onclick="forwardmessage('complete')"> <i class="fa fa-send"></i> &nbsp;&nbsp;&nbsp;Complete Action</button>
                      <a href="<?php echo base_url()?>index.php/Settings/view_ods_dashboard/"> <button type="button" class="btn btn-warning">
                      <i class="fa fa-dashboard" aria-hidden="true"  ></i>&nbsp;&nbsp;&nbsp;Dashboad</span>
                      </button>
                    </a>
                   </div>    
                </div>
            </div>
            </form>
        </div>
    </div>
</div>

~

I expect concatenated  parameter  that I passed from first view page to retrieve data from table and populate it into the final view page.

1 Antworten

  • M.Hemant
    4. Mai 2019

    Wenn Sie über Daten wie l/54 oder l/59 mit varchar-Datentyp-Spalte dann folgenden Abfrage wird die Arbeit.

    public function tracks($letterno="")
    {   
          //$query= $this->db->get_where('st_dak_details',array('dakLetterNo'=>$letterno));
          $this->db->select('*');
          $this->db->from('st_dak_details');
          $this->db->like('dakLetterNo', $letterno); //'%l/54%'
          $query= $this->db->get();
          if ($query->num_rows() > 0) {
                return $query->row();
          } else {
                return array();
          }
    }