Solved

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

Posted on 2013-06-04
5
240 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
  • 2
  • 2
5 Comments
 
LVL 108

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 108

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now