I am trying to get the values of the first 9 clicked buttons and put them into an array named $u_input. I actually found this, but its in javascript.
my html:
<div>
<button name="btn1" type="submit" id="btn1" value="1" style="width:50%;height:40%;margin-left: auto;margin-right: auto; float:left" class="ui-btn"></button>
<button name="btn2" type="submit" id="btn2" value="2" style="width:50%;height:40%;margin-left: auto;margin-right: auto;float:right" class="ui-btn"></button>
</div> // I have up to 9 buttons, thats only a piece
my javascript:
$(document).ready(function(){
$('.ui-btn').click(function(){
var clickBtnValue = $(this).val();
var ajaxurl = 'escreen.php',
data = {'action': clickBtnValue};
$.post(ajaxurl, data, function (response) {
});
});
});
my php:
if (isset($_POST['action'])) {
$u_input = array($_POST['action'](1), $_POST['action'](2), $_POST['action'](3), $_POST['action'](4));
echo $u_input;
}
<button id="btn-1"> value-1 </button>