can Help me, I Went to get data on the SPIN of wheels from JS to Mysql
I trial GET data to Form input, but can’t get data Spin.
My Expectation if spin stops, the user clicks SUBMIT data and Updates data to MYSQL
Thanks All for help
code
HTML Input:
<form method="post" action="submitaction.php" enctype="multipart/form-data" >
<div id="chart"></div>
<div id="data"><b></b><h1><?php echo $data['nama']; ?>, Selamat Anda Mendapatkan..........</h1><b></div>
<div id="submit">
<input type="submit" name="submit" class="btn btn-success" value="submit">
<!--<a style='font-size:20px;' href="submitaction.php?id=<?php echo $data['id'];?>" name="submit" class="btn btn-primary btn-xs">Submit</a></td>-->
</div>
<div id="question">
<h1></h1>
<!--<input type="text" name='question' id="question" readonly="readonly">-->
</div>
<div>
<!--<label style="font-size: large;font-weight: bold;position: relative; ">Nomer Member</label> <br> -->
<input style="text-align: center;" type="ba" name='ba' id="ba" size="30" value="<?php $question; ?>" >
</div>
<div id="submit">
<input type="submit" name="submit" class="btn btn-success" value="submit">
</div>
JS
function spin(d){
container.on("click", null);
//all slices have been seen, all done
console.log("OldPick: " + oldpick.length, "Data length: " + data.length);
if(oldpick.length == data.length){
console.log("done");
container.on("click", null);
return;
}
var ps = 360/data.length,
pieslice = Math.round(1440/data.length),
rng = Math.floor((Math.random() * 1440) + 360);
rotation = (Math.round(rng / ps) * ps);
picked = Math.round(data.length - (rotation % 360)/ps);
picked = picked >= data.length ? (picked % data.length) : picked;
if(oldpick.indexOf(picked) !== -1){
d3.select(this).call(spin);
return;
} else {
oldpick.push(picked);
}
rotation += 90 - Math.round(ps/2);
vis.transition()
.duration(6000)
.attrTween("transform", rotTween)
.each("end", function(){
//mark question as seen
d3.select(".slice:nth-child(" + (picked + 1) + ") path")
.attr("fill", "#111");
//populate question
d3.select("#question h1")
.text(data[picked].question);
oldrotation = rotation;
container.on("click", spin);
document.getElementById("click").onclick = null;
});
}
DATA Spin
var data = [
{"label":"xa0xa0xa0xa0 xa0xa0xa0xa0 ?"+"xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0", "value":1, "question":"A"}, // padding
{"label":"xa0xa0xa0xa0 xa0xa0xa0xa0 ?"+"xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0", "value":1, "question":"B"}, // padding
{"label":"xa0xa0xa0xa0 xa0xa0xa0xa0 ?"+"xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0", "value":1, "question":"C"}, // padding
FOrm Submit
<?php
include 'koneksi.php';
error_reporting(0);
date_default_timezone_set('Asia/Jakarta');
$today= date("Y-m-d H:i:s");
if (isset($_POST['submit'])) {
$question = $_GET['question'];
$id = trim(strip_tags($_POST['id']));
// $coupon = trim(strip_tags($_POST['coupon']));
$tlp = trim(strip_tags($_POST['tlp']));
$nama = trim(strip_tags($_POST['nama']));
$produk = $_POST['produk'];
// $store = trim(strip_tags($_POST['store']));
$store = $_POST['store'];
$ba = $_POST['ba'];
print $ba;
print $nama;
print $question;
// include "koneksi.php";
$selSto =mysqli_query($conn, "SELECT * FROM stock WHERE produk='$produk'");
$sto =mysqli_fetch_array($selSto);
$stok =$sto['qty'];
//menghitung sisa stok
$sisa =$stok-1;
}
?>
.
I trial GET data to Form input, but can’t get data Spin.
My Expectation if spin stops, the user clicks SUBMIT data and Updates data to MYSQL