I have this html code:
<form method="POST" action="location/files/myscript.php">
<input type="radio" name="choice" value="ex1">
<input type="radio" name="choice" value="ex2">
<button type="button" id="print">
</form>
I know there is no submit button, but I send a request with ajax like this:
$('#print').on('click', () => {
request = $.ajax({
url: "location/files/myscript.php",
type: "POST",
data: dataD
});
}
And my php file looks like this:
$choice = $_POST['choice'];
if($choice == 'ex1') {
echo "yes";
} else {
echo "no";
}
I tried with isset and empty too, but I still get Undefined array key "choice"
EDIT: no, I don't want the warning just to disappear. The problem is that I select a radio button and it is still returning that warning. I want it to work, not no hide the warning