Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 我想在重定向到消息页面时获取教师的用户名_Php_Codeigniter - Fatal编程技术网

Php 我想在重定向到消息页面时获取教师的用户名

Php 我想在重定向到消息页面时获取教师的用户名,php,codeigniter,Php,Codeigniter,请帮助我,我被困在这个问题上了。 当学生点击“提问”按钮时,学生将重定向到消息页面,但我希望当学生重定向时,特定教师的用户名将显示在撰写消息脚本上 <?php if($usertype == "Student") { ?> <td data-title="<?=$this->lang->line('action')?>"> <a href="<?=base_url("mark/view")?>"><input

请帮助我,我被困在这个问题上了。 当学生点击“提问”按钮时,学生将重定向到消息页面,但我希望当学生重定向时,特定教师的用户名将显示在撰写消息脚本上

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


我个人会用饼干。像这样:

setcookie("teacher", $teacher_name);
然后您可以像这样访问cookie:

$teacher = $_COOKIE["your cookie name"];
更多信息可在此处找到:


您是否意识到您没有在HTML引号中回显值?Butt sb您能否转储/print\r($subject)以查看您是否从模型中获取了教师姓名
$teacher = $_COOKIE["your cookie name"];