Solved

How to make a 2nd. combo to use the option choosed at the 1st combo?

Posted on 2013-06-04
5
244 Views
Last Modified: 2013-06-05
Hi Experts!

How to make a 2nd. combo to use the option choosed at the 1st combo?

Accordingly to the code bellow, the way it's coded the 2nd. combo doesn't use the 1st. combo parameter.


<?php

....

    //----------Code start Combo (DSGER Despesa Hierárquica)--------------------------------------------
  $nivel=1;    // default parameter

 $sql1 = "select sb_dge, dge_info, substr(descricao,1,25) as descricao from dsger 
             where tipo=2 and nivel=".$nivel." order by descricao;";

    // Configurar o nivel:
     $query1 = mysql_query($sql1);
     while ( $results1[] = mysql_fetch_object ( $query1 ) );
     array_pop ( $results1 );
    //----------Final Combo 2-------------------------------------------------------------------------

....

<br/>
/////// 1st. Combo that furnish the parameter "nível" //////
Nivel Totalizador Despesa:
<select name="nivel">
    <option value="1">    1     </option>
    <option value="2">    2     </option>
</select>

<?php
   //After choosen 1st. parameter

    //----------Inicio Combo 2 (DSGER Despesa Hierárquica)--------------------------------------------

     echo "Nivel....".$nivel;

     $sql1 = "select sb_dge, dge_info, substr(descricao,1,25) as descricao from dsger 
             where tipo=2 and nivel=".$nivel." order by descricao;";

    // Configurar o nivel:
     $query1 = mysql_query($sql1);
     while ( $results1[] = mysql_fetch_object ( $query1 ) );
     array_pop ( $results1 );
    //----------Final Combo 2-------------------------------------------------------------------------
?>

<br/>
Despesa (H):
<select name="sb_dsg">
<?php 
     //----------Intend to present Combo 2 configured--------------------
     foreach ( $results1 as $option ) : ?>
          <option value="<?php echo $option->sb_dsg; ?>"><?php echo $option->descricao; ?></option>
<?php 
     endforeach; 
?>
</select> 

Open in new window


What must be done ?

Thanks in advance!
0
Comment
Question by:Eduardo Fuerte
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 250 total points
ID: 39220813
Sometimes it is all about how you ask the question.  In this case, it is!

Please make a Google search for jquery dependent dropdown.
0
 
LVL 15

Assisted Solution

by:Jagadishwor Dulal
Jagadishwor Dulal earned 250 total points
ID: 39220901
0
 

Author Comment

by:Eduardo Fuerte
ID: 39221699
Ok, I'm seeking...
0
 

Author Closing Comment

by:Eduardo Fuerte
ID: 39222305
Thanks for your assistance, again....
I was miles away from solution before it...
I'm new in PHP and getting more proficiency with your replies!
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39222335
jQuery (client side JavaScript) intersects PHP (server side script) in the AJAX technology.  You might find this article interesting.
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/A_10712-The-Hello-World-Exercise-with-jQuery-and-PHP.html

Thanks for the points, ~Ray
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question