GET url parameters Codeigniter -
there 1 view, , 1 controller, necessary, use of parameter, change path link. in end turned out this:
upcoming -> http://mywebsite.com/tournaments?type=upcoming
finished -> http://mywebsite.com/tournaments?type=finished
here controller process variable
controller <?php class demo_controller extends ci_controller { public function demo($id) { echo $id; //the id in url string } } ?>
view file pass variable
<?php $id = "1";//dyanmic id pased form echo form_open('demo/demos-function'.$id); //in between code echo form_close ?> routes inside routes.php $route['demo/demos-function/(:any)] = demo_controller/demo/$1
no need change $1 explain routes having url paramater. link be
https://localhost/demo/demos-function/1 https://localhost/demo/demos-function/2
Comments
Post a Comment