Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $db = "un";
- $conn = new mysqli($servername,$username,$password,$db);
- if ($conn->connect_error){
- die ("Connection failed:" .$conn->connect_error);
- }
- $sql = "SELECT nama_ujian, tanggal_ujian_dimulai FROM ujian";
- $result = $conn->query($sql);
- ?>
- <head>
- <title>Transaksi</title>
- <h1>Transaksi</h1>
- </head>
- <p>Nama Produk</p>
- <?php
- $id=0;
- if ($result->num_rows > 0){
- while($data = $result->fetch_assoc()){
- $id++;
- echo "<input type='radio' name='item' value='{$data['tanggal_ujian_dimulai']}' id='id$id'>".$data['nama_ujian']."</br>";
- }
- } else{
- echo "0 results";
- }
- $query = "SELECT harga from produk WHERE nama_produk = 'value'"
- ?>
- <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
- <script>
- $(document).ready(function(){
- $("input[type='radio']").click(function(){
- var radioValue = $("input[name='item']:checked").val();
- if(radioValue){
- // alert("Your are a - " + radioValue);
- $('#qty').val(radioValue);
- }
- });
- });
- </script>
- <!-- <script>
- function displayR() {
- var ele = document.getElementsByName('item');
- for(i = 0; i < ele.length; i++) {
- if(ele[i].checked) ;
- console.log(ele[i].value);
- // document.getElementById("result").innerHTML
- // = "Gender: "+ele[i].value;
- }
- }
- </script> -->
- <form action="transaksi.php">
- Kuantitas: <input type="text" id="qty" name="qty">
- </form>
- <?php
- $conn->close();
- ?>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement