我在不同的帖子中看到过这个问题的答案,但是答案似乎对我没有用,所以我想问。如何将每个提交两个不同表单的一个post 2按钮内联?我尝试过在按钮上添加显示:内联和内联块,但它似乎不起作用。
这是我的密码:
echo "<div class = 'actCell'>";
echo "<form id = ".$i." name='edit_company' class='form-inline' enctype='multipart/form-data' action = '/DTS/index.php/Index/viewDocumentType' method = 'POST'>";
echo "<input type = 'hidden' name = 'doc_type' value = '".$doc_type." '/>";
echo "<input type = 'hidden' name = 'doc_id' value = '".$doc_id." '/>";
echo "<button onclick='document.getElementById(".$i.").submit()'/><span class = 'editBut' style = 'display: inline;'><img src =".base_url()."images/glyphicons_edit.png class = 'editImg'></span></button>";
echo "</form>";
//echo "<td><input type = 'submit' value = 'Edit'/></td>";
echo "<form id = del".$i." name='delete_docType' class='form-inline' enctype='multipart/form-data' action = '/DTS/index.php/delete_info/deleteInfoDocumentType' method = 'POST'>";
echo "<input type = 'hidden' name = 'doc_type' value = '".$doc_type." '/>";
echo "<input type = 'hidden' name = 'doc_id' value = '".$doc_id." '/>";
echo "<button onclick = 'return deleteRow(this)' /><span class = 'delBut' style = 'display: inline;'><img src =".base_url()."images/glyphicons_exclamation_mark.png class = 'delImg'></span></button>";
echo "</form>";
echo "</div>";
echo "</div>";CSS代码:
.editAction, .actCell{
text-align: left;
display: table-cell;
}注意:这些按钮是表的一部分,因此在包含表单的div上显示表格单元格。
发布于 2014-05-27 01:28:34
重新排列HTML元素,并将按钮与表单(表单外)分隔开来:
当您必须提到属性值时,它们应该在双引号内。因此,使用单引号在php中回显这些行。
echo '<div class = "actCell">';
echo '<form id = "'.$i.'" name="edit_company" class="form-inline" enctype="multipart/form-data" action = "/DTS/index.php/Index/viewDocumentType" method = "POST">';
echo '<input type = "hidden" name = "doc_type" value = "'.$doc_type.'" />';
echo '<input type = "hidden" name = "doc_id" value = "'.$doc_id.'" />';
echo '</form>';
//echo "<td><input type = 'submit' value = 'Edit'/></td>";
echo '<form id = "del'.$i.'" name="delete_docType" class="form-inline" enctype="multipart/form-data" action = "/DTS/index.php/delete_info/deleteInfoDocumentType" method = "POST">';
echo '<input type = "hidden" name = "doc_type" value = "'.$doc_type.'" />';
echo '<input type = "hidden" name = "doc_id" value = "'.$doc_id.'" />';
echo '</form>';
echo '<button onclick="document.getElementById("'.$i.'").submit()"><span class = "editBut"><img src ="'.base_url().'images/glyphicons_edit.png" class = "editImg"></span></button>';
echo '<button onclick = "return deleteRow(this)" ><span class = "delBut" ><img src ="'.base_url().'images/glyphicons_exclamation_mark.png" class = "delImg"></span></button>';
echo '</div>';
echo '</div>';
set css to:
button{ display: "block"; float: "left"; }在最后一个按钮后添加额外的div标记:
echo '<div style="clear:both;"></div>';注意:默认情况下,span元素是内联显示的。因此,如果您之前没有更改css,则不需要将css内联显示。
https://stackoverflow.com/questions/23879693
复制相似问题