www.webdeveloper.com
Results 1 to 3 of 3

Thread: dyanamic multiple value selected dropdownlist to textbox

  1. #1
    Join Date
    Apr 2012
    Posts
    2

    dyanamic multiple value selected dropdownlist to textbox

    hi,
    can any1 help with the code ,how to create multiple select dropdownlist which retrieves data from database in the dropdown and the selcted multiple values should appear in the textbox using javascript, php and database
    please help me in new in this
    thanx in advance.

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,377
    Your question is very vague and lacking any type of example of what it is that you are trying to do.
    Therefore, this is just a guess at starting to figure out what it is that you want.
    See: http://www.webdeveloper.com/forum/sh...d.php?t=259734

  3. #3
    Join Date
    Apr 2012
    Posts
    2

    dropdown values add to textbox

    here is my php code which shows 2 drop down list the 2 drop down list retrives values from database but i want to add the selected values in the list box how can it be possible?? i m using ajax, php and mysql.
    PHP Code:


    <?php
      $con 
    mysql_connect("localhost","user","");
    if (!
    $con)
      {
      die(
    'Could not connect: ' mysql_error());
      }

    mysql_select_db("info"$con);
      
    /***********************website****************************/
      
    $query "SELECT DISTINCT website FROM urls1";
      
    $result mysql_query($query);
      
      
    $str1 ="<select element=\"website\" onchange=\"htmlData('user.php', 'website='+this.value, 'elementresult')\">";
              echo 
    "<BR>";

      while(
    $rs mysql_fetch_assoc($result)){
        
    $str1 .= '<option value="'.$rs['website'].'">'.$rs['website'].'</option>';
      }
      
    $str1 .= '</select>';
      
      
    /***********************element****************************/
      
    $query "SELECT element FROM urls1";
      
    $result mysql_query($query);
      
    $str2 ="<select element=\"element\" onchange=\"htmlData('user.php', 'element='+this.value, 'websiteresult')  onchange=elementresult(value) \">";        echo "<BR>";
               
               while(
    $rs mysql_fetch_assoc($result)){
        
    $str2 .= '<option value="'.$rs['element'].'"></option>';        

      }
      echo 
    "<BR>";
    ?>
    <script language="javascript" type="text/javascript">
            function CompanyNameCBtoTB(){
                document.getElementById("website").value=document.getElementById("str1").value
            }

    </script>
    <html>

    <head>
    <title>websites</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
       <script src="ajax_req.js" type="text/javascript"></script>
    </head>
    <body>
    <table>
    <tr><td>
    <form method="post" >
    <div id="websiteresult"><?php echo $str1;?></div><br/><br/>
    </td></tr>
    <tr><td>
    <div id="elementresult"><?php echo $str2;?></div><br/><br/>
     <br/>
    </td></tr>
    <tr><td>
    <input name="website" type="text" id="website" value="<?php echo $website ?>" size="60" readonly="true" />
    </td></tr>
    <tr><td>
    </tr></td>
    <tr><td>
    <input type="submit"/>
    </td></tr>
    </form>
    </table>
    </body>
    </html>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles