【发布时间】:2015-09-19 13:51:17
【问题描述】:
我正在尝试对 li 内的 a href 执行操作,这是我的选择器代码:
<td class="small-col"><input name="selector[]" type="checkbox" value="<?php echo $sender_message_id; ?>"/></td>
对于下拉菜单:
<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>
此代码用于消息,我试图在下拉列表中执行操作,我该怎么办?
对于在表单和按钮上起作用的操作,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");
}
?>
【问题讨论】:
-
<a>标记不是表单...您到底想要它做什么? -
由于安全问题,
mysql扩展也已被弃用,请使用参数化查询 -
我想在下拉菜单和选择器上的下拉菜单上进行操作。
-
action不是<a>的属性 ...更具体地说明您的<a>应该做什么或您想要实现的总体目标
标签: javascript php jquery html twitter-bootstrap