Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2013-06-04
5
Medium Priority
?
249 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 111

Accepted Solution

by:
Ray Paseur earned 1000 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 1000 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 111

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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 …
Suggested Courses

604 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