Semantic-ui
主要使用jquery
和javascript
。因此,当您使用他们的jquery复选框并选中它时,它会向其添加" checked
"类。
问题是,我想使用 PHP isset()
函数,知道复选框是否被选中,但由于复选框本身没有被选中,所以我不能。
如何识别PHP
上的选中Semantic-ui
复选框?谢谢。
形式:
<form class="ui form" action="your_action.php" method="post">
<div class="field">
<label>First Name</label>
<input type="text" name="first-name" placeholder="First Name">
</div>
<div class="field">
<div class="ui checkbox">
<input name='check' type="checkbox" tabindex="0" class="hidden">
<label>I agree to the Terms and Conditions</label>
</div>
</div>
<button name='action' value="submit" class="ui button" type="submit">Submit</button>
</form>
your_action.php
只需选中复选框为:
if ($_REQUEST['action'] == 'submit') {
if(isset($_REQUEST['check']) and $_REQUEST['check'] == 'on') {
//do you stuff
}
如果你想在javascript中检查,请使用复选框的"被选中"行为
$('.ui.checkbox').checkbox(<i>behavior</i>, argumentOne, argumentTwo...);