Dear All ,

In my website there is an inputbox . When I click on it ,light box will be opened where list of products and its product is will come from database . Now when I select any product ,this product come(ie visible ) in my inputbox. Here is my code:

         <!-- DIV for Product lightbox starts-->
              <div id="light" class="white_content">
                <div class="white-header"> 
                          <!--- link to close </---> 
            <a class="close" href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">x</a>                </div>
                <div class="white-body">
                          <img src="image/logo3.png"/> <br/>
                          <!--- Text for Help. COOKIES </--->
                          <p align="left">
                         <!-- Product from database starts-->
                                        //connecting to database
                                         $db = mysql_connect("localhost","root","") or die(mysql_error());
                                        //selecting my database
                                         $db_select = mysql_select_db("csoftworld", $db) or die(mysql_error());
                                         $sql="SELECT * FROM   product";    
                                         echo "<div id='tablerow'>";
                                                echo "<div>";
                                                echo "<div id='".$res['ID']."'>".$res['product_name']."</div>";
                                                echo "</div>";
                                        echo "</div>";

                         <!--Product from database ends -->
                              <div>Product  Data two </div>
                          <div> Product Data three</div>

                      <div id="fade" class="black_overlay"></div>
                      <!--DIV for Product lightbox ends-->
                      <td><a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'"> 
                        <!-- <input type="text" name="A1[]" class="maxWidthL" id="<?php// echo $id;?>" value="<?php //echo $productname;?>"  readonly="readonly"/>-->
                        <input type="text" name="A1[]" class="maxWidthL" id="inputboxID" value="<?php echo $productname;?>"  readonly="readonly"/>

    <script language='javascript'>
         var xrow = document.getElementById("tablerow").rows.length;
        for (var i = 1; i < xrow+1; i++)
            document.getElementById(i).addEventListener('click', loadText);

        function loadText() {
            document.getElementById('inputboxID').value = this.innerHTML || this.innerText;


After displaying product in inputbox ,productid is needed to sent in an another page .

Thanks in advance,


3 Years
Discussion Span
Last Post by nauticalmac
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.