简体   繁体   English

在同一表单页面中显示消息

[英]to display message in same form page

I need to add a notification to this page saying " Thank you for your feedback" However,the notification did not appear at the correct place,which is above the form. 我需要在此页面上添加一条通知,说“谢谢您的反馈”。但是,该通知没有出现在表格上方的正确位置。

This is my code. 这是我的代码。

      $message="tq 4 feedback";
      $common->display_message($message);

This is where the feedback form. 这是反馈表。 The function i'm using is 我正在使用的功能是

    function display_message($message) {
print $message;
}

Thanks 谢谢

It's probably an issue with your view, to be honest. 老实说,这可能与您的观点有关。 What's your view look like? 您的视图是什么样的?

Not sure why if you have the message already you are passing it to a function to display, but you need to "return" the variable from the function. 不知道为什么已经有了消息,然后将其传递给函数以显示,但是您需要从函数中“返回”变量。 Then you can echo it out wherever you need to. 然后,您可以在任何需要的地方回显它。

function display_message($message) {
    return $message;
}

To call it: 调用它:

$message="tq 4 feedback";
$returned_message = $common->display_message($message);

And place it where you want: 并将其放在您想要的位置:

echo $returned_message;

or just: 要不就:

$message="tq 4 feedback";
echo $common->display_message($message);

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

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