Ребята, вопрос похоже очень популярный, но я столкнулся с этим, а разобраться не могу. нужно значение выбранного радиобаттона отправлять в скрипт
<?php
$con = mysql_connect("localhost","root","");
mysql_select_db("convertor", $con) or die(mysql_error());
$result = mysql_query("SELECT * from diagram ORDER BY diagramnumber");
?><?
if (mysql_num_rows($result) > 0)
{
$resultt = mysql_fetch_array($result);
$i==0;
?><script src='https://code.jquery.com/jquery-3.1.1.min.js'></script>
<form id="form_id"><?
do {
?>
<input type="radio" name="rrr" value="<?echo $i++;?>"><?echo $resultt['name'];?>
<Br>
<?
}
while($resultt = mysql_fetch_array($result)); ?>
<input type="submit" name="znach" value="Построить график" accept="text/xml" onClick="document.getElementById('one').contentWindow.location.reload(true);">
</form>
<script type="text/javascript">
$(function() {
$('#form_id').submit(function(e) {
e.preventDefault();
var isCheck = 0;
for (var i = 0; i < this.rrr.length; i++) {
if (this.rrr[i].checked) {
isCheck = 1;
break;
}
}
if (!isCheck) {
alert('Выберите вариант ответа');
return;
}
$.ajax({
type: 'post',
url: 'drawline.php',
data: $(this).serialize(),
success: function(result) {
$('#form_id').html(result);
}
});
});
});
</script>
<?
}
else { echo '-Нет диаграмм'; }
?>