Have main php page called tipComp.php that has script as follows to submit a value selected on a radio buttom from a form.
<script>
$('input[type=radio]').on('change', function() {
$(this).closest("form").submit();
});
// Go back to game picked tip on
$(function () {
var pathName = document.location.pathname;
window.onbeforeunload = function () {
var scrollPosition = $(document).scrollTop();
sessionStorage.setItem("scrollPosition_" + pathName, scrollPosition.toString());
}
if (sessionStorage["scrollPosition_" + pathName]) {
$(document).scrollTop(sessionStorage.getItem("scrollPosition_" + pathName));
}
});
</script>
The form is called via two functions that display a range of values as per the form below:
<div class='schedRangeContainer'>
<form action='./includes/addPick.php' method='post' class='pickForm' name='tipPicks'>
<ul id='pickRange'>
<li class='schedPickRange'>1<center><input class='schedRadioBtn' type='radio' name='score' value=1></center></label></span>
<li class='schedPickRange'>2<center><input class='schedRadioBtn' type='radio' name='score' value=2></center></label>
<li class='schedPickRange'>3<center><input class='schedRadioBtn' type='radio' name='score' value=3></center></label>
</ul>
</form>
</div>
The form displays fine as do all of the radio buttons. On clicking the radio button it should add the selected value to the database via the addPick.php code however it is not submitting the form and running the php file.
The page does have two other scripts that run from the navbar.php file using the following eventlistener code and run okay:
window.addEventListener("scroll", stickyFunction);
window.addEventListener("scroll", scrollFunction);
I've tried running the code with this script disabled but does not make a difference.
It is the only form on the page and had been working previously but unfortunately I seem to have fixed it until it doesn't work! Any assistance that can be provided I will be most grateful.