如何使用CodeIgniter在MySQL的复选框中存储fa-icons值。
<form method="post" action="/action_page.php">
<div>
<input type="checkbox" id="fa-icon" name="icon" value="cat">
</div>
<div>
<button type="submit">submitt</button>
</div>
</form>
在此示例中,我们有一个图标的名称和一个cat的值。提交表单后,数据名称/值对将为icon = cat。
如果省略了value属性,则复选框的默认值为on,因此在这种情况下,提交的数据将为animal = on。
<i class="icon-<?= $this->input->post('icon'); ?>"></i> <img src="cat-<?= $this->input->post('icon'); ?>.jpg" height="42" width="42">
将为您提供“ cat -image或cat-icon”
通过使用名称属性name属性指定元素的名称。 name属性用于引用JavaScript中的元素,或在提交表单后引用表单数据。注意:提交表单时,只有具有name属性的表单元素才会传递其值。