How to direct url to controller

Hello, I am beginner in yii and php, Hope I could explain myself.
I created controller which is called TourItemController.php. In this controller I have function called actionCreate.

Also, I have addtour.php in backend/views/tour/addtour.php. The thing is that I want to direct the user to addtour.php page and fill the forms. Sİnce I configured the create function, the data that the user was entered will be saved into the database. I am not sure what to the right url part

<a href="<?php echo Url::to(['tour-item/create']); ?>" class="btn btn-app">Click here to add tour item


class TourItemController extends Controller
public function actionCreate($id)
    $cityes = ArrayHelper::map(City::find()->all(),'id','name');
    $destinations = ArrayHelper::map(Destination::find()->all(),'id','title');
  goes like that }}

 Thanks for your time and help

Hi yasoyase, here are the two best tutorials on the URL topic:

1 Like

Hi @yasoyase,

IMO, it’s not a good idea to go back and forth between 2 controller actions when you want the user to input a block of data. Your tour-item/create page should contain all the necessary fields to input the data.