www.webdeveloper.com
Results 1 to 1 of 1

Thread: Need help in getting values of two textboxes using jquery

  1. #1
    Join Date
    Oct 2011
    Posts
    350

    Need help in getting values of two textboxes using jquery

    Hi,

    I am new in using JQuery, so now I only know is getting the value of one textbox. But now I need to get the value of the first textbox which is the process id. So that on my query on getting the machine I could also base on what process.

    here is my code:

    PHP Code:
    <?php
      error_reporting
    (0);
     
    session_start();
      
    ob_start();
      
    date_default_timezone_set("Asia/Singapore");
      
      include(
    'connection.php');
      
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <title>Operator's Shift Report </title>
    <head>

    <script type="text/javascript" src="jquery.js"></script>
    <script type='text/javascript' src='jquery.autocomplete.js'></script>
    <link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" />

    <script type="text/javascript">

    //----auto complete process name---//

    $().ready(function() {
        $("#process_name").autocomplete("get_process_list.php", {
           width: 205,
            matchContains: true,
            mustMatch: true,
            selectFirst: false
        });
        
        $("#process_name").result(function(event, data, formatted) {
            $("#process_id").val(data[1]);
        });  
         
    });

    //------auto complete machine 1---//
    $().ready(function() {
        $("#machine_1").autocomplete("get_machine_1.php", {
            width: 205,
            matchContains: true,
            mustMatch: true,
            selectFirst: false
        });
        
         $("#machine_1").result(function(event, data, formatted) {
            $("#ma_1").val(data[1]);
        });
    });

    </script>
    </head>
    <body>
    <form name="operator_report" action="<?php echo $PHP_SELF?>" method="post" autocomplete="off">
        <!--Tab List -->
    </div>
    <div id="operators_report">
    <fieldset>
    <legend><h1>Operator's Shift Report</h1></legend>

    <table>
    <td>Process:</td>
    <td><input type="text" name="process_name" id="process_name" value="" size="30" ></td>
    <td>Machine 1: </td>
    <td><input type="text" name="machine_1" id="machine_1" value="" size="30"></td>
    </tr>

    </table>

    </fieldset>
    </div>
    <input type="text" name="process_id" id="process_id" value="" />
    <input type="text" name="ma_1" id="ma_1" value="" />
    <div id="op_output_fieldset">

    </div>
    </form>
    </body>
    </html>
    here is my code in getting the machine name
    //---in this code I just want to get the process_id, but I have no idea what jquery code should I need to use to get the value of process_id.
    PHP Code:
    <?php
    ob_start
    ();
    include 
    "connection.php";
    $q strtolower($_GET["q"]);
    //if (!$q) return;
    if ($q == '') {
       
    header("HTTP/1.0 404 Not Found"true404);   
    }
    else
    {
    $sql "select machine_id, machine_name from machine_list where machine_name LIKE '$q%'";
    $rsd mysql_query($sql);
    $cnt mysql_num_rows($rsd);

        if(
    $cnt 0)
        {
            while(
    $rs mysql_fetch_array($rsd)) {
                
    $sid $rs['machine_id'];
                
    $sname $rs['machine_name'];
                echo 
    "$sname|$sid\n";
            }
        }
        else
        {
            
    header("HTTP/1.0 404 Not Found"true404);    
        }   
    }
    ?>
    Last edited by newphpcoder; 07-23-2013 at 02:29 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles