簡體   English   中英

當我重定向到消息頁面時,我想獲取老師的用戶名

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

請幫我解決這個問題。 當學生單擊“問問題”按鈕時,該學生將重定向到消息頁面,但是我希望當該學生將重定向時,特定教師的用戶名將出現在撰寫消息腳本中。

<?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 } ?>

關於主題的教師表是

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

請幫助我解決這個問題。 提前致謝

我個人會使用cookie。 像這樣:

setcookie("teacher", $teacher_name);

然后,您可以像這樣訪問cookie:

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

更多信息可以在這里找到:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM