Welcome Guest, Not a member yet? Register   Sign In
ask about uri segment
#1

[eluser]nencor[/eluser]
i got a view like this
Code:
<td id="action"> <a href="&lt;?php echo site_url('c_kategorimaterial/ubah/'.$row-&gt;Kode_Kategori_Material_Jasa/$row-&gt;Nama_Material_Jasa);?&gt;">Edit </a>| Delete </td>

i want to pass the Kode_Kategori_Material_Jasa and Nama_Material_Jasa variable into c_kategorimaterial/ubah controller

here is my controller

Code:
ubah()
{$getid = $this->uri->segment(3);
        $getnama = $this->uri->segment(4);
        
        echo $getid.' '.$getnama;
}

and the browser shows
Quote:A PHP Error was encountered

Severity: Warning

Message: Division by zero

Filename: v/vkategorimaterial.php

how do i pass these 2 variables into controller, and echo them ?
#2

[eluser]alexwenzel[/eluser]
You can pass any variable to a controller method with the below synthax:

Url:

Code:
controller/method/var1/var2/var3/varxy

Controller:

Code:
Controller {

method($var1, $var2, $var3, $varxy) {

  var_dump($var1, $var2, $var3, $varxy);

}

}
#3

[eluser]p. z.[/eluser]
You are supposed to quote the slash
Code:
$row->Kode_Kategori_Material_Jasa . '/' . $row->Nama_Material_Jasa
#4

[eluser]nencor[/eluser]
thanks p.z. it really help !




Theme © iAndrew 2016 - Forum software by © MyBB