简体   繁体   English

当我重定向到消息页面时,我想获取老师的用户名

[英]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. 我个人会使用cookie。 Like this: 像这样:

setcookie("teacher", $teacher_name);

Then you can access the cookie like this: 然后,您可以像这样访问cookie:

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

More information can be found here: 更多信息可以在这里找到:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我要在登录时显示欢迎用户名的消息 - I want to display the welcome username's message when logged in 登录后如何重定向到我想要的页面,登录成功后如何显示用户名 - How to redirect to the page that I want after logged in and display username after successful login 我想在用户名输入标签下显示有关现有用户名的消息,并在显示消息时其他数据不会在php中丢失 - I want show message about existing username under username input tag and when show the message other the data doesn't lose in php 我想使用用户名作为url中的页面地址 - I want to use username as a page address in url 我要在用户登录后将他们重定向到个人资料页面 - I want to redirect users when they after login, to profile page 我想使用来自 formRequest 的消息重定向用户 - i want to redirect user with a message from formRequest 当我提交后重定向时,我得到一个空白页面 - When I redirect after submit, I get a blank page 我想获取用户ID,但是当我打开页面时,它显示0 - I want to get the user id but when i open the page , it shows 0 Yii登录未重定向到我想要的页面 - Yii login does not redirect to the page i want 如何通过Ajax完成用户名和传递请求时重定向页面 - How can i redirect page when username and pass request complete via ajax
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM