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

    Unanswered: Pulling values from the populated dropdownlist

    Hi Friends,

    In my project, i need to pull the values from the populated drop down list using PHP and Oracle DB. So I need to show the quantity from the head mark i chose. Please help me with this problem.

    PHP Code:
     <section>
                                    <div class="row">
                                        <div class="col4 first">
                                            <label for="headmark" class="lbl-text tleft">HEADMARK :</label>
                                        </div><!-- end .col4 section -->
                                        <div class="col8 last">
                                            <label for="headmark" class="lbl-ui select">
                                              <select id="headmark" name="headmark" onChange="">
                                                    <?php while (oci_fetch($paint_parse)){?>
                                                    <option value="headmark_sel" id="headmark"> <?php echo "$head_mark"?></option> <?php ?>
                                              </select>
                                            </label>     
                                        </div>    
                                    </div>                        
                               </section>                                                  
                               <section>
                                    <div class="row">
                                        <div class="col4 first">
                                            <label for="lnames" class="lbl-text tleft">Total Quantity:</label>
                                        </div><!-- end .col4 section -->
                                        <div class="col8 last">
                                            <label class="lbl-ui">
                                                <!-- Show Corresponding head mark quantity in this field -->
                                                <h1><?php $qty_parse ?></h1>
                                            </label>
                                        </div><!-- end .col8 section -->    
                                    </div><!-- end .row section-->                            
                               </section>

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    traditional web design is by pages
    server sends page to user, user interacts with page, page data sent back to server, server interprets data and sends new page
    what I think you want is more an AJAX approach, where by integrating Javascript into the web page.. Javascript can alter contents of pages its hosted in, and or interact with the server and or db server
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2014
    Posts
    44
    Quote Originally Posted by healdem View Post
    traditional web design is by pages
    server sends page to user, user interacts with page, page data sent back to server, server interprets data and sends new page
    what I think you want is more an AJAX approach, where by integrating Javascript into the web page.. Javascript can alter contents of pages its hosted in, and or interact with the server and or db server
    Yes I tried that approach and this is my approach,

    this is combined into one file update_fab_progress.php
    PHP Code:
    <script>
            function 
    showQty(str){
            if (
    str==""){
              
    document.getElementById("txtHint").innerHTML="";
              return;
              } 
            if (
    window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
              
    xmlhttp=new XMLHttpRequest();
              } else {
    // code for IE6, IE5
              
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            
    xmlhttp.onreadystatechange=function(){
              if (
    xmlhttp.readyState==&& xmlhttp.status==200){
                
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
                }
              }
            
    xmlhttp.open("GET","update_fab_progress.php?q="+str,true);
            
    xmlhttp.send();
            }
            
    </script> 
    PHP Code:
    <legend>&nbsp Select HEADMARK and the details will be shown <span class="bubble blue">1</span></legend>
                               <section>
                                    <div class="row">
                                        <div class="col4 first">
                                            <label for="headmark" class="lbl-text tleft">HEADMARK :</label>
                                        </div><!-- end .col4 section -->
                                        <div class="col8 last">
                                            <label for="headmark" class="lbl-ui select">
                                              <select id="headmark" name="headmark" onChange="showQty(this.value)">
                                                    <option value=" ">Select Head Mark</option>
                                                    <?php while (oci_fetch($paint_parse)){?>
                                                    <option value="headmark_sel" id="headmark"> <?php echo "$head_mark"?></option> <?php ?>
                                              </select>
                                            </label>     
                                        </div>    
                                    </div>                        
                               </section>                                                  
                               <section>
                                    <div class="row">
                                        <div class="col4 first">
                                            <label for="lnames" class="lbl-text tleft">Total Quantity:</label>
                                        </div><!-- end .col4 section -->
                                        <div class="col8 last">
                                            <label class="lbl-ui">
                                                <!-- Show Corresponding head mark quantity in this field -->
                                                <?php
                                                $q 
    intval($_GET['q']);
                                                
    $result oci_parse($conn"SELECT QTY FROM FABRICATION WHERE HEAD_MARK = '".$q."'");
                                                
                                                
    oci_execute($result);
                                                    
                                                    
    $row oci_fetch($result);
                                                
    ?>
                                                <h1><?php echo $row ?></h1>
                                            </label>
                                        </div><!-- end .col8 section -->    
                                    </div><!-- end .row section-->                            
                               </section>
    I keep getting UNDEFINED INDEX q Error, what am i doing wrong here ?

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    I havent' got a clue. I decidced a long long tiem ago that debugging Javascript was tricky.

    but off hand Id expect that the script cannot find the specified html form element... it cannot find the index of that element
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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