Advertisement

01.27.2006 at 01:19AM PST, ID: 21712472
[x]
Attachment Details

Select box with dynamic textfield

Asked by ski3r in Miscellaneous Web Development

Tags: tep_draw_pull_down_menu

Ok, I've got a table with names, id's, and descriptions. What I would like to do is that when I select a name in a select box the description-text will shown in an textfield. This is what I've got now (It only outputs the dropdown menu):
   
-------------------------------------
$question_one = array();
$question_one[] = array('id' => '2', 'text' =>ANSWER_DEFAULT);
$question_one_querry = tep_db_query("select sources_id, sources_name from " . TABLE_QUESTIONS . " where question_number =1 order by sources_name");
while($question_one_values =  tep_db_fetch_array($question_one_querry)) {
                           $question_one[] = array('id' =>  $question_one_values['sources_name'],
                           'text' => $question_one_values['sources_name']);
 }

 echo tep_draw_pull_down_menu('', $question_one);

------------------------------------


The tep_draw_pull_down_menu function looks like this:
------------------------------------
 function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {
    $field = '<select name="' . tep_output_string($name) . '"';

    if (tep_not_null($parameters)) $field .= ' ' . $parameters;

    $field .= '>';

    if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);

    for ($i=0, $n=sizeof($values); $i<$n; $i++) {
      $field .= '<option value="' . tep_output_string($values[$i]['id']) . '"';
      if ($default == $values[$i]['id']) {
        $field .= ' SELECTED';
      }

      $field .= '>' . tep_output_string($values[$i]['text'], array('"' => '&quot;', '\'' => '&#039;', '<' => '&lt;', '>' => '&gt;')) . '</option>';
    }
    $field .= '</select>';

    if ($required == true) $field .= TEXT_FIELD_REQUIRED;

    return $field;
  }
---------------------------..Start Free Trial
 
Keywords: Select box with dynamic textfield
 
Loading Advertisement...
 
[+][-]01.27.2006 at 01:29AM PST, ID: 15803198

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.27.2006 at 01:39AM PST, ID: 15803250

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.27.2006 at 01:40AM PST, ID: 15803260

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.27.2006 at 02:18AM PST, ID: 15803417

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.27.2006 at 05:07AM PST, ID: 15804341

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.27.2006 at 05:10AM PST, ID: 15804360

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.27.2006 at 05:17AM PST, ID: 15804401

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.27.2006 at 05:37AM PST, ID: 15804530

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Miscellaneous Web Development
Tags: tep_draw_pull_down_menu
Sign Up Now!
Solution Provided By: rnby
Participating Experts: 2
Solution Grade: C
 
 
[+][-]02.18.2006 at 10:17AM PST, ID: 15989663

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]02.18.2006 at 11:02AM PST, ID: 15989890

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32