www.webdeveloper.com
Results 1 to 2 of 2

Thread: Passing values not working in JS, PHP and Oracle

  1. #1
    Join Date
    Mar 2014
    Posts
    2

    Passing values not working in JS, PHP and 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.

    In this case I could query the corresponding quantity with the headmark. Please help me..

    PHP Code:
    <script type="text/javascript"
            function 
    OnSelectionChange (select) { 
                var 
    selectedOption select.options[select.selectedIndex]; 
                
    alert ("The selected option is " selectedOption.value); 
            } 
    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
    Mar 2007
    Location
    localhost
    Posts
    2,290
    You either need to set a cookie or you use a Form to pass the data to a new page with the GET method or pass the data to the server and incorporate it in the next page.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

Thread Information

Users Browsing this Thread

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

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
  •  
HTML5 Development Center



Recent Articles