dpzbzp8728 2015-09-19 13:51
浏览 124

如何在<li> a href中添加动作?

I am trying to put an action on an a href inside an li and this is my code for the selector:

<td class="small-col"><input name="selector[]" type="checkbox" value="<?php echo $sender_message_id; ?>"/></td>

and for the dropdown:

<div class="btn-group">
  <button type="button" class="btn btn-default btn-sm btn-flat dropdown-toggle" data-toggle="dropdown">
    Action <span class="caret"></span>
  </button>

  <ul class="dropdown-menu" role="menu">
    <li><a href="read_message.php" type="submit" method="post">Mark as read</a></li>
    <li><a href="#">Mark as unread</a></li>
    <li class="divider"></li>
    <li><a href="#">Move to junk</a></li>
    <li class="divider"></li>
    <li><a href="#">Delete</a></li>
  </ul>

</div>

this code is for messages and im trying to put an action on the dropdown, what should i do?

and for the action, which this works on the form and button, href is different so i cannot make this work,

<?php
include('session.php');
 include('connect.php');
 if (isset($_POST['read'])){
$id=$_POST['selector'];
 $N = count($id);
for($i=0; $i < $N; $i++)
 {
 $result = mysql_query("update message_received set message_status = 'read' where message_id='$id[$i]'");
 }
header("location: mailbox.php");
}

?>

anyway the screenshot, this is an unread enter image description here

  • 写回答

1条回答 默认 最新

  • douqiang4245 2015-09-19 14:13
    关注

    You can do in several ways the simples is call different php files for different request like different command in a table command column

    <ul class="dropdown-menu" role="menu">
       <li><a href="read_message.php" type="submit" method="post">Mark as read</a></li>
       <li><a href="unread_message.php">Mark as unread</a></li>
       <li class="divider"></li>
       <li><a href="move_junck.php">Move to junk</a></li>
       <li class="divider"></li>
       <li><a href="delete.php">Delete</a></li>
    </ul>
    
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度