Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2014
    Posts
    44

    Unanswered: Need help with onChange method PHP + Oracle

    I need help with mo coding problem. I need to design database update with ORACLE, PHP and JavaScript. So the deal is, I can get the populated dropdown list working and I can see the values. When i select a particular entry, the onchange tag will call java script so it can direcly getting the values from the server.

    Any kind of help would be greatly appreciated since i need to deliver this in short time

    In my case, i need to query the quantity at the same time when user select the value, here is my code

    JavaScript
    PHP Code:
    <script type="text/javascript">
            function 
    OnSelectionChange (select) {
                var 
    selectedOption select.options[select.selectedIndex];
                
    alert ("The selected option is " selectedOption.value);
            } 
    PHP
    PHP Code:
     <label for="headmark" class="lbl-ui select">
                                                <?php         
                                                $sql_hm_comp 
    'SELECT HEAD_MARK FROM FABRICATION';

                                                
    $result oci_parse($conn$sql_hm_comp);
                                                
    oci_execute($result);

                                  
                                                echo 
    '<SELECT name="headmark" id="headmark" onchange="OnSelectionChange(this)">'.'<br>';
                                                echo 
    '<OPTION VALUE=" ">'."".'</OPTION>';

                                                while(
    $row oci_fetch_array($result,OCI_ASSOC)){
                                                     
    $HM $row ['HEAD_MARK'];
                                                     echo 
    "<OPTION VALUE='$HM'>$HM</OPTION>";
                                                }
                                                echo 
    '</SELECT>';
                                            
    ?>
                                            </label>     
                                        </div>    
                                    </div>                        
                               </section>                                                  
                              <section>
                                    <div class="row">
                                        <div class="col4 first">
                                            <label for="lnames" class="lbl-text tleft">Total Quantity:</label>
                                        </div>
                                        <div class="col8 last">
                                            <label class="lbl-ui">
                                            <?php
                                                
    //THIS WILL DISPLAY QUANTITY FOR THE GIVEN HEADMARK
                                                
    $sql_hm_qty "SELECT QTY FROM FABRICATION WHERE HEAD_MARK = '$HM'";

                                                
    $qty_result oci_parse($conn$sql_hm_qty);
                                                
    oci_execute($qty_result);
                                                
                                                
    $qty oci_fetch($qty_result);
                                                echo  
    "<label class='lbl-ui'>'.$qty.' </label>";
                                                echo 
    $qty;
                                            
    ?>                                      
                                        </div>    
                                    </div>                        
                               </section>

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    So what's your question?
    George
    Home | Blog

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by gvee View Post
    So what's your question?
    I don't really know how to debug Javascript is my guess
    I'd rather be riding on the Tiger 800 or the Norton

Tags for this Thread

Posting Permissions

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