php - displaying a single row in view of codeignitor -


hi new in codeigniter , using version 2.1.3_2

i want send single row model controller controller view. checked of same kind of question discussed earlier here couldn't fix it

code controller is

   public function updateq() {     $qid1=$this->input->get('qid',true);     $showd['data1']=$this->quiz_model->updateq($qid1);     $this->load->view('quiz/update',$showd); } 

code model is

    public function updateq($qid1) {     $this->db->where('qid',$qid1);     $up=$this->db->get('question');     return $up->row(); } 

now code view is

    <!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>     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />     <title>untitled document</title>     </head>      <body>     <?php echo form_open('quiz/update');     ?>      <table width="77%" height="327" align="center" border="1">     <tr>     <td height="39" colspan="2" align="center">     <h2> update question here</h2>     </td>     </tr>     <tr>     <td width="97">question</td>     <td width="287"><textarea name="question" id="textarea" cols="45" rows="2" required="required" value="<?php echo $data1->question;?> "></textarea></td>     </tr>     <tr>     <td colspan="2">&nbsp;</td>     </tr>     <tr>     <td>option 1 :</td>     <td><textarea name="option1" id="textarea3" cols="45" rows="2" required="required" value="<?php echo $data1->option1 ;?> "></textarea></td>     </tr>     <tr>     <td>option 2 :</td>     <td><textarea name="option2" id="textarea4" cols="45" rows="2" required="required"value="<?php echo $data1->option2;?> "></textarea></td>     </tr>     <tr>     <td>option 3: </td>     <td><textarea name="option3" id="textarea5" cols="45" rows="2" required="required"value="<?php echo $data1->option3;?> "></textarea></td>   </tr>   <tr>   <td>option 4:</td>  <td><textarea name="option4" id="textarea6" cols="45" rows="2" required="required"value="<?php echo $data1->option4;?> "></textarea></td>  </tr>  <tr>  <td>   <label for="select2">correct answer</label></td>  <td><select name="ra" id="select2">   <option value="select correct option">select correct option</option>   <option value="option1">option1</option>   <option value="option2">option2</option>   <option value="option3">option3</option>   <option value="option4">option4</option> </select></td>  </tr>  <tr>  <td colspan="2"><input type="submit" name="button1" id="button2" value="submit question &ans;  answer" /></td>  </tr>   </table>   </body>   </html> 

i have checked query returning row. cant understand why getting blank text boxes in view. please help.

regards dibyendu

try this:

<textarea name="option1" id="textarea3" cols="45" rows="2" required="required"><?php echo $data1->option1 ;?></textarea> 

paste php code inside textarea instead using value attribute.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -