简体   繁体   English

PHP成功消息处理

[英]php success message handling

I've a form i slideDown with Jquery, and a php script in which i need to redirect after sendind data to server (php),and also showing a "success" message (not in the url but in the form). 我有一个表单,我使用Jquery进行slideDown,还有一个php脚本,在其中,我需要在sendind数据之后重定向到服务器(php),并且还显示“成功”消息(不在url中,而是在表单中)。
I'm doing it this way (as i found here in stackoverflow): 我这样做(如我在stackoverflow中找到的):

header("location:VIP.php?response=1");

and and in VIP.php right after : 然后在VIP.php中:

if (isset ($_GET['response']))
{
    if ($_GET['response']=="1")
    {
      echo "Se ha registrado con éxito"; //this is my success message (spanish)
    }
}

it works like a charm, the only thing is thay i need to style this, it shows at the top left of the body ... and i don't know how to make it show in the form (or any other specific div) 它就像一个魅力一样工作,唯一的事情就是我需要对此进行样式设置,它显示在主体的左上角……而且我不知道如何使其以形式(或任何其他特定的div)显示

If anyone can enlight me, i'd much appreciate it.Thanks! 如果有人能启发我,我将非常感激。谢谢!

Do it like this: 像这样做:

if (isset ($_GET['response']))
{
   if ($_GET['response']=="1")
   {
       $msg = "Se ha registrado con éxito"; //this is my success message (spanish)
   }
}

and then somewhere in your html page (eg in your form): 然后在您的html页面中的某处(例如您的表单):

<?php if( $msg ): ?><div class="notice"><?php echo $msg ?></div><?php endif; ?>

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

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