Passing Variable By Url In Yii?
Rate Topic:

I know how to use POST and GET method in yii, now I want to pass the data by URL link. For example, I want the output like this: "site/index.php?var1=data1&var2=data2" and retrieve the data with $_POST['var1']. Is there any specific way to do these actions in Yii or just simply use the normal php way?

I know how to use POST and GET method in yii, now I want to pass the data by URL link. For example, I want the output like this: "site/index.php?var1=data1&var2=data2" and retrieve the data with $_POST['var1']. Is there any specific way to do these actions in Yii or just simply use the normal php way?

it is recommended to avoid accessing _GET, _POST and _REQUEST arrays directly. you should use

One more thing is about the direction, for example, I currently open the page site/index.php in the folder site and want to perform an action to link to other page main/action.php in other folder with these code "main/action.php?back1=data1&back2=data2". Im trying to use both redirect and header to do it, not yet use form to send data. The problem is either redirect or header, the root path is from C: drive, not inside the framework folder. So it turn to become like that: redirect("C:/xampp/httdocs/yii/main/action.php?back1=data1&back2=data2"). Is there any way to do it more convenient with Yii style (without using form)?

One more thing is about the direction, for example, I currently open the page site/index.php in the folder site and want to perform an action to link to other page main/action.php in other folder with these code "main/action.php?back1=data1&back2=data2". Im trying to use both redirect and header to do it, not yet use form to send data. The problem is either redirect or header, the root path is from C: drive, not inside the framework folder. So it turn to become like that: redirect("C:/xampp/httdocs/yii/main/action.php?back1=data1&back2=data2"). Is there any way to do it more convenient with Yii style (without using form)?

redirectoing to another action usually is not needed. you can use CAction descendant actions or other components/helpers/etc that should allow you get same effect without redirects... even between applications - you can share components/models folder, etc. if there are common code parts - they should be moved to another class which can be used in every place where same logic is needed.