我有這個切換按鈕代碼。如何從POST方法這個切換按鈕值傳遞..如何通過引導中的切換按鈕傳遞值
<div class="form-group col-md-4">
<label>Sold Out</label>
<div>
<button data-toggle="collapse">YES</button>
<button data-toggle="collapse">NO</button>
</div>
</div>
我有這個切換按鈕代碼。如何從POST方法這個切換按鈕值傳遞..如何通過引導中的切換按鈕傳遞值
<div class="form-group col-md-4">
<label>Sold Out</label>
<div>
<button data-toggle="collapse">YES</button>
<button data-toggle="collapse">NO</button>
</div>
</div>
試試這個
<?php
if (isset($_POST['yesBtn'])) {
echo "<p>".$_POST['yesBtn']."</p>";
}
if (isset($_POST['noBtn'])) {
echo "<p>".$_POST['noBtn']."</p>";
}
?>
<form action="somefile.php" method="POST">
<div class="form-group col-md-4">
<label>Sold Out</label>
<div>
<button data-toggle="collapse" name="yesBtn" value="YES">YES </button>
<button data-toggle="collapse" name="noBtn" value="NO">NO</button>
</div>
</div>
</form>
或者這
<?php
if (isset($_POST['Btn'])) {
echo "<p>".$_POST['Btn']."</p>";
}
?>
<form action="somefile.php" method="POST">
<div class="form-group col-md-4">
<label>Sold Out</label>
<div>
<button data-toggle="collapse" name="btn" value="YES">YES </button>
<button data-toggle="collapse" name="btn" value="NO">NO</button>
</div>
</div>
</form>
你想它的按鈕,立即執行後的動作點擊...或者會有另一個按鈕提交? –