Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action="delivery_add.php" method="POST" id="forms">
- <div class="form-group">
- <label>Delivery Receipt: </label>
- <input type="number" name="Receipt" class="form-control" />
- </div>
- <div class="form-group">
- <label>Delivery Date: </label>
- <input type="date" name="Date" class="form-control" />
- </div>
- <div class="form-group">
- <label>Supplier Name:</label>
- <select name="Supplier" class="form-control">
- <?php
- include('config.php');
- $sql = "SELECT Supplier_ID, Supplier_Name FROM tbl_supplier";
- $result = mysql_query($sql);
- while ($row = mysql_fetch_array($result)) {
- echo "<option value=".$row[0].">";
- echo $row[1];
- echo "</option>";
- }
- ?>
- </select>
- </div>
- <a id="clickbtn" class="btn btn-default">Add Item</a>
- <button type="submit" class="btn btn-default">Process</button>
- <div class="form-group">
- <table class="table table-bordered table-hover"><br/>
- <tr>
- <td width="250">
- <label>Product Name:</label>
- </td>
- <td width="100">
- <label>Delivered Quantity:</label>
- </td>
- <td width="200">
- <label>Price:</label>
- </td>
- </tr>
- </table>
- <div id="form-sample">
- <table class="table table-bordered table-hover">
- <tr>
- <td width="250">
- <select name="Product_ID[]" class="form-connect" id="pta" onchange="myFunction(this)">;
- <?php
- $sql = "SELECT Product_ID, Product_Name FROM tbl_product";
- $result = mysql_query($sql);
- while ($row = mysql_fetch_array($result)) {
- echo "<option value=".$row[0].">";
- echo $row[1];
- echo "</option>";
- }
- ?>
- </select>
- </td>
- <td width="100">
- <input type="number" name="Quantity[]" placeholder="0" class="form-connect" required />
- </td>
- <td width="200">
- <input type="number" name="Price[]" placeholder="0.00" class="form-connect" id="prices" disabled>
- </td>
- </tr>
- </table>
- </div>
- </div>
- </form>
- <script>
- function myFunction(productID) {
- $.post(
- 'trial5.php',
- {
- product_id: productID
- },
- function (data) {
- document.getElementById('prices').value = data;
- }
- );
- }
- </script>
- The code for trial5.php
- <?php
- include('config.php');
- $query = "SELECT Del_Price FROM tbl_product WHERE Product_ID=".$_POST['prodID'];
- $result = mysql_query($query)or die(mysql_error());
- $row = mysql_fetch_array($result);
- echo "$row[0]";
- ?>
- The code for append:
- $(document).ready(function () {
- var newRow = $('#form-sample');
- var counter = 0;
- newRow.attr('id', counter);
- $("#clickbtn").click(function () {
- $('#forms').append(newRow).html();
- counter++;
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement