如何使用引导类警报显示成功消息PHP代码

编程入门 行业动态 更新时间:2024-10-19 04:24:02
本文介绍了如何使用引导类警报显示成功消息PHP代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在使用PHP更新或插入记录时,我需要显示成功消息

I need to display Success Message while update or insert records in using PHP

这是我的HTML代码

<form action='a.php' methord='post'> // alert message here <div class="alert"> <a class="close" data-dismiss="alert"><i class="icon-remove"></i></a> <strong><?php echo $message; ?></strong> </div> <input type="text" class="form-control" style="height:27px;" name="name"\> <input type="email" class="form-control" style="height:27px;" name="email"\> <input type="tel" class="form-control" style="height:27px;" name="mobile"\> <input type="submit" name="user_details" class="btn btn-danger" value="Submit" /> </form>

Php代码(a.php):

Php Code (a.php):

if(isset($_POST['user_details'])) { $name = $_POST['name']; $email = $_POST['email']; $mobile= $_POST['mobile']; $sql = mysql_query("update user_details set name='$name', email='$email', mobile='$mobile'"); if($sql==true) { $message = 'Success'; } else { echo ''.mysql_error(); } }

推荐答案

HTML

HTML

<div class="form-group"> <div class="col-sm-10 col-sm-offset-2"> <?php echo $result; ?> </div> </div>

PHP

PHP

if ($error == false) { $result='<div class="alert alert-success">Thank You! I will be in touch</div>'; }else { $result='<div class="alert alert-danger">Sorry there was an error sending your message. Please try again later</div>'; }

更多推荐

如何使用引导类警报显示成功消息PHP代码

本文发布于:2023-11-26 18:10:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1634637.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   如何使用   消息   代码   PHP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!