Box of values in php and js



  • Changed the question by adding specifics in code form.

    There is a table with a list of courses and evaluations. There's a button in front of every course. Send result♪ The click shall be marked in bd with parameters in the request for the appropriate course and evaluation.

    lib.php

    <html>
    <head>
    

    <script type = "text/javascript">
    function sendResult() {
    if(confirm("Send result?")) {
    $.ajax({
    url: "checkquery.php",
    type: "POST",
    success: function() {
    alert("Submitted!");
    }
    });
    } else {
    return false;
    }
    }
    </script>
    </head>
    <body>
    <?php
    $link = '<a onclick = "return sendResult()" href = "..." target = "_blank">Send result</a>';
    echo $link;
    ?>

    </body>
    </html>

    checkquery.php

    $db = "...";

    $conn = oci_connect($login, $pass, $db, "CL8MSWIN1251") or die("Error");

    $query = "INSERT INTO...";
    $stid = oci_parse($conn, $query);
    oci_execute($stid, OCI_DEFAULT);
    }



  • It's very hard to tell by your code. But you should use XMLHtpRequest in JS (Ajax) as follows. You have some kind of violin for the ajax.php, which takes the form data, injects your lib.php file and then calls for a fill_table method. Accordingly, in order to transmit the data from the form to the screen for_ajax.php, you may consider the following material: http://xmlhttprequest.ru

    I think it'll make sense.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2