Welcome Guest, Not a member yet? Register   Sign In
my session did not show
#11

[eluser]yudahebat[/eluser]
I have change my views into
Code:
<table width="645" border="0" cellpadding="0" cellspacing="0" class="tabel" >
                <tr>
                    <td width="130" class="tabel" align="center"><p>Car Type</p></td>
                    <td width="110" class="tabel" align="center"><p>Rent date</p></td>
                    <td width="110" class="tabel" align="center"><p>Return date</p></td>
                    <td width="80" class="tabel" align="center"><p>Duration</p></td>
                    <td width="100" class="tabel" align="center"><p>Price/day</p></td>
                    <td width="110" class="tabel" align="center"><p>Suhtotal</p></td>
                </tr>
                &lt;?php $i = 1; ?&gt;
                <tr>
                    <td width="130" class="tabel"><p>&lt;?= $this->session->userdata($i.'nama');?&gt;</p></td>
                    <td width="110" class="tabel"><p>
                    &lt;?php $data = array(  'name'        => 'renttgl',
                                          'id'          => 'renttgl',
                                          'value'       => '',
                                          'style'       => 'width:70%',
                                          'class'       => 'w16em dateformat-Y-ds-m-ds-d',
                                        );
                    echo form_input($data);?&gt;</p></td>
                    <td width="110" class="tabel"><p>
                    &lt;?php $data = array(  'name'        => 'rettgl',
                                          'id'          => 'rettgl',
                                          'value'       => '',
                                          'style'       => 'width:70%',
                                          'class'       => 'w16em dateformat-Y-ds-m-ds-d',
                                        );
                    echo form_input($data);?&gt;</p></td>
                    <td width="80" class="tabel"><p>..day</p></td>
                    <td width="100" class="tabel"><p>$ &lt;?= $this->session->userdata($i.'harga');?&gt;</p></td>
                    <td width="110" class="tabel"><p>$..</p></td>
                </tr>
                &lt;?php $i++; ?&gt;
                <tr>
                    <td colspan="4" class="tabel2"><p>&lt;?php echo form_submit('', 'send request'); ?&gt;</p></td>
                    <td  class="tabel2"><p>Total</p></td>
                    <td  class="tabel2"><p>$...</p></td>
                </tr>
                    
                </table>

and my controller

Code:
function v_cart()
    {
        $data['css']         = $this->css;
        $data['css2']        = $this->css2;
        $data['base']         = $this->base;
        $data['menu_web']     = $this->menu;
        $data['myrobots']     = '&lt;meta name="robots" content="noindex,nofollow"&gt;';
        $data['mywebtitle'] = 'mrputucar | Your cart';
        
        $this->output->enable_profiler(TRUE);
        $this->session->set_userdata(array('id' => $this->input->post('id'),'nama' => $this->input->post('nama'),'photo' => $this->input->post('photo'),'harga' => $this->input->post('harga')));
    
        $this->load->view('v_cart',$data);
    }

but the
Code:
&lt;?= $this->session->userdata($i.'nama');?
and
Code:
&lt;?= $this->session->userdata($i.'harga');?
won't show. whats wrong??
#12

[eluser]Thorpe Obazee[/eluser]
[quote author="yudahebat" date="1245237379"]I have change my views into
Code:
<table width="645" border="0" cellpadding="0" cellspacing="0" class="tabel" >
                <tr>
                    <td width="130" class="tabel" align="center"><p>Car Type</p></td>
                    <td width="110" class="tabel" align="center"><p>Rent date</p></td>
                    <td width="110" class="tabel" align="center"><p>Return date</p></td>
                    <td width="80" class="tabel" align="center"><p>Duration</p></td>
                    <td width="100" class="tabel" align="center"><p>Price/day</p></td>
                    <td width="110" class="tabel" align="center"><p>Suhtotal</p></td>
                </tr>
                &lt;?php $i = 1; ?&gt;
                <tr>
                    <td width="130" class="tabel"><p>&lt;?= $this->session->userdata($i.'nama');?&gt;</p></td>
                    <td width="110" class="tabel"><p>
                    &lt;?php $data = array(  'name'        => 'renttgl',
                                          'id'          => 'renttgl',
                                          'value'       => '',
                                          'style'       => 'width:70%',
                                          'class'       => 'w16em dateformat-Y-ds-m-ds-d',
                                        );
                    echo form_input($data);?&gt;</p></td>
                    <td width="110" class="tabel"><p>
                    &lt;?php $data = array(  'name'        => 'rettgl',
                                          'id'          => 'rettgl',
                                          'value'       => '',
                                          'style'       => 'width:70%',
                                          'class'       => 'w16em dateformat-Y-ds-m-ds-d',
                                        );
                    echo form_input($data);?&gt;</p></td>
                    <td width="80" class="tabel"><p>..day</p></td>
                    <td width="100" class="tabel"><p>$ &lt;?= $this->session->userdata($i.'harga');?&gt;</p></td>
                    <td width="110" class="tabel"><p>$..</p></td>
                </tr>
                &lt;?php $i++; ?&gt;
                <tr>
                    <td colspan="4" class="tabel2"><p>&lt;?php echo form_submit('', 'send request'); ?&gt;</p></td>
                    <td  class="tabel2"><p>Total</p></td>
                    <td  class="tabel2"><p>$...</p></td>
                </tr>
                    
                </table>

and my controller

Code:
function v_cart()
    {
        $data['css']         = $this->css;
        $data['css2']        = $this->css2;
        $data['base']         = $this->base;
        $data['menu_web']     = $this->menu;
        $data['myrobots']     = '&lt;meta name="robots" content="noindex,nofollow"&gt;';
        $data['mywebtitle'] = 'mrputucar | Your cart';
        
        $this->output->enable_profiler(TRUE);
        $this->session->set_userdata(array('id' => $this->input->post('id'),'nama' => $this->input->post('nama'),'photo' => $this->input->post('photo'),'harga' => $this->input->post('harga')));
    
        $this->load->view('v_cart',$data);
    }

but the
Code:
&lt;?= $this->session->userdata($i.'nama');?
and
Code:
&lt;?= $this->session->userdata($i.'harga');?
won't show. whats wrong??[/quote]

I honestly don't understand how that would work.
Code:
&lt;?= $this->session->userdata($i.'nama');?
is non-existent so you'll just get (bool) FALSE.

PS. Are you for real?
#13

[eluser]yudahebat[/eluser]
Code:
&lt;?= $this->session->userdata('nama');?
i erase the $i and it show the session, but when I add another data again,the new data replace last data. I want the last data still there, how to make that?
#14

[eluser]Thorpe Obazee[/eluser]
you can use an array




Theme © iAndrew 2016 - Forum software by © MyBB