简体   繁体   English

如何在里面放一个动作<li>一个href?

[英]how to put an action inside <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:我正在尝试对 li 内的 a href 执行操作,这是我的选择器代码:

<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,对于在表单和按钮上起作用的操作,href 是不同的,所以我无法完成这项工作,

<?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无论如何截图,这是一个未读的在此处输入图片说明

You can do in several ways the simples is call different php files for different request like different command in a table command column您可以通过多种方式进行简单的操作,即为不同的请求调用不同的 php 文件,例如表命令列中的不同命令

<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>

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

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