So i have this script that supposed to pass values of buttons on the backend
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$monday_hours = $_POST['monday_hours'];
echo $monday_hours;
}
?>
Here is the html code.
<div class = "mon-btn-group">
<form method="post">
<button type = "button" name = "monday_hours" value = "1_hour">1</button>
<button type = "button" name = "monday_hours" value = "2_hours">2</button>
<button type = "button" name = "monday_hours" value = "3_hours">3</button>
</form>
</div>
So my question is without changing the type is it possible for this group of buttons values to be caught in the backend if they all have the same name like radio buttons or checkboxes?
It echos the value if i remove the type = "button" but I dont want that since i read that buttons have submit as their default behaviour.
Send Bootstrap Button-Group value in a form with Get or Post
EDIT: Nevermind found this post, thanks guys sorry, its my first time posting.