简体   繁体   中英

I want to get the username of the teacher when i redirect to the message page

kindly help me i am stuck on this issue. when a student click on "Ask Question" button then the student will redirect to the message page but i want that when the student will redirect then the username of the specfic teacher will appears on the compose message script.

<?php  if($usertype == "Student") { ?>
<td data-title="<?=$this->lang->line('action')?>">
    <a href="<?=base_url("mark/view")?>"><input type="submit" class="btn btn-success btn-view" style="margin-bottom:10px" value="View Marks" ></a>
    <a href="<?=base_url("message/add")?>"><input type="submit" class="btn btn-success" style="margin-bottom:0px" value="Ask Questions"></a>
</td>
<?php } ?>

the table of teacher with respect to the subjects are

<td data-title="<?=$this->lang->line('subject_teacher')?>">
    <?php echo $subject->teacher_name; ?>
</td>

kindly help me to solve this issue. Thanks in advance

I would use a cookie, personally. Like this:

setcookie("teacher", $teacher_name);

Then you can access the cookie like this:

$teacher = $_COOKIE["your cookie name"];

More information can be found here:

http://php.net/manual/en/features.cookies.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM