Solved

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

Posted on 2013-06-04
5
241 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
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 …

929 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

11 Experts available now in Live!

Get 1:1 Help Now