Welcome Guest, Not a member yet? Register   Sign In
Using QUERY_STRING on CI4
#3

(This post was last modified: 11-14-2020, 09:32 AM by captain-sensible.)

the other thing you might be missing is routes

default route is:

$routes->get('/', 'Home::index');

that means when someone goes to just domain , then what happens is defined in Controller Home and method inside Controller home called index.

You can have get and post requests eg

Code:
$routes->get('addProduct','Product::productAddForm');
$routes->post('addProduct','Product::addProductDo');

lines mean: ('url',' Controller Class::methodOfClass)

my first one means when admin goes to url domain.com/addProduct they get a form .Method productAddForm looks like

Code:
public function productAddForm()
          
          {
               $data = [
                        'title'  => 'add product ',
                        'date'=>$this->myDate,
                        'info'=>' '
                ];
                echo view('addProductForm',$data);
          }



forgot to mention this elelement of route:

Code:
$routes->get('blogArticle/(:segment)', 'Blog::showArticle/$1');
then in Controller


Code:
    public function showArticle($theSlug)
                    
                    {
//to see value of $theSlug
echo $theSlug
Reply


Messages In This Thread
Using QUERY_STRING on CI4 - by lucky - 11-14-2020, 04:44 AM
RE: Using QUERY_STRING on CI4 - by includebeer - 11-14-2020, 05:31 AM
RE: Using QUERY_STRING on CI4 - by lucky - 11-14-2020, 07:22 AM
RE: Using QUERY_STRING on CI4 - by includebeer - 11-14-2020, 10:07 AM
RE: Using QUERY_STRING on CI4 - by lucky - 11-14-2020, 10:20 AM
RE: Using QUERY_STRING on CI4 - by captain-sensible - 11-14-2020, 06:18 AM
RE: Using QUERY_STRING on CI4 - by InsiteFX - 11-20-2020, 05:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB