Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //index.php
- <script type="text/javascript">
- $(document).ready(function()
- {
- $(".autodoc").change(function()
- {
- var id=$(this).val();
- var dataString = 'id='+ id;
- $.ajax
- ({
- type: "POST",
- url: "ajax_price.php",
- data: dataString,
- cache: false,
- success: function(html)
- {
- $(".pay").html(html);
- }
- });
- });
- });
- </script>
- .
- .
- <form action="bill_submit.php" method="POST" id="bbe">
- <input type="text" name="name" id="textfield2" class="input-xlarge" data-rule-required="true" data-rule-minlength="1" placeholder="Name" maxlength="30">
- <input type="text" name="med" id="keyword" tabindex="0" class="autodoc">
- .
- .
- </form>
- //ajax_price.php
- <?php
- include('db_conn.php');
- if ($_POST['id']) {
- $id = $_POST['id'];
- $query = "select * from pharma where name='$id' ";
- //echo $query;
- $result = mysqli_query($con, $query);
- if (mysqli_affected_rows($con) != 0) {
- while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
- echo "<input class='txt' type='text' value ='" . $row['per_unit_price'] . "' name='txt' id='fbname' readonly/>";
- }
- } else {
- echo "<input class='txt' type='text' value ='$name' name='txt' id='fbname' readonly/>";
- }
- }
- ?>
Add Comment
Please, Sign In to add comment