doulu1325 2014-11-29 19:05
浏览 29

如何使用隐藏的div和多个条件运行多个查询

I have multiple buttons for different tasks and after the task is completed successfully success/failure message it displayed on the hidden div. it displays message for some time and then it disappears again.

Hidden div:

<script type="text/javascript">
    function showHide() {
            document.getElementById("hidden_div").style.display = "block";
    }
</script>

sample forms:

<form action="" method="post">
<input type="submit" value="Claim " id="btn" name="fbook" onclick="showHide()">
</form>

<form action="" method="post">
<input type="submit" value="Claim " id="btn" name="twitter" onclick="showHide()">
</form>

php code

if(isset($_REQUEST['fbook'])) {
echo " facebook ";
}
if(isset($_REQUEST['twitter'])) {
echo " twitter ";
}

The problem:
when I click the first form button it displays the "facebook" , and then refreshes the page. when I click 2nd form button it displays again the same message "facebook" , and then refreshes the page. when I press again the 2nd button, it displays the correct message " twitter ".

What I need to achieve:

I have 10+ conditions for users to meet. and on each condition i want to award them bonuses, once the required queries are generated then the success or failure message is to be displayed on the hidden div.

Kindly suggest any other alternative way to accomplish the task.

If i am able to get rid of the form and use hyper link to achieve the task that would be more great.

updated code :

<div class="group">
<div class="echo" id="hidden_div" style="display:none ;width: 610px;height: 25px;border: 1px #e72727 solid;  -webkit-border-radius: 10px;border-radius: 10px;">
<?php
//Code for level 1 points
if(isset($_REQUEST['fbook'])) {
//sql queries goes here
echo " facebook ";
}
if(isset($_REQUEST['twitter'])) {
//sql queries goes here
echo " twitter ";
}
// and rest of the conditionss will also be written like this
//Code for level 3 points


?>
</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
    • ¥15 帮我写一个c++工程
    • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
    • ¥15 关于smbclient 库的使用