Issue
This is the code
<a type="button" class="btn btn-info" href="<?php echo CHtml::normalizeUrl(array(Yii::app()->controller->getId() . '/createStudent')); ?>">Add Student</a>
I want to pass class ID to the controller create student along with the url. The class id is in the variable
<?php $classId = $selectedSchoolClass->getId();?>
Solution
If I understand you, you have almost did it, you should only concatenate it with the &
caracter and send the new param/data with the URL:
Yii::app()->controller->getId() . '/createStudent&classId='.$classId;
From the controller you can receive the data with:
$request = Yii::$app->request;
$classId = $request->get('classId');
// equivalent to: $classId = isset($_GET['classId']) ? $_GET['classId'] : null;
Hope it helps!
Answered By - JP. Aulet
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.