So because my experience with jquery is zero i have no idea how to run my mysql script when the form is submitted without reloading a page? in short form radio button submit --> form sended --> query without reload
My script:
<form id="myForm" method="get">
<div class="row">
<div class="span4 info1">
<section class="widget">
<img src="../bootstrap/img/thumb/0.jpg" width="auto" height="auto">
<?php if ($selectedBg == '0') {
echo '<h2>Current one</h2>';
} ?>
<input type="radio" name="options[]" value="0" onclick="document.getElementById('myForm').submit();"/>
Choose Background
</section>
</div>
</div>
<?php
$checked = $_GET['options'];
for ($i = 0; $i < count($checked); $i++) {
$sql = 'UPDATE blog_users SET background = '.$checked[$i].' WHERE username=?';
$bg = $db->prepare($sql);
$bg->execute(array($session->username));
}
?>
</form>
So my question is how do I submit my form without reloading the page + running my query?