Announcement

Collapse
No announcement yet.

move data from one listbox to another list box

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • move data from one listbox to another list box

    Hi,


    How to move data from one listbox to another list box in php?
    any one can give an example ........



    Thanks,
    Sreenu.G

  • #2
    Re: move data from one listbox to another list box

    Can you please provide an example of what you need to do ?
    If made in php it will probably require refreshing the page, if made through Javascript or Ajax it may be done on real time (without refreshing the page).
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

    Comment


    • #3
      Re: move data from one listbox to another list box

      Thanks for helping..

      my code is

      <td style="width: 100px;"><label for="city1">City(s)</label>
      <br />

      <?php
      $city1 = $_POST['CityId1'];
      if($country)
      echo $this->formSelect('CityId1', $city1, array('multiple'=>'true','style'=>'height: 100px; width: 100px;'), $this->getCitysinIndia());// here i will get all the cites those will be in first list box
      else
      echo $this->formSelect('CityId1', 'Hyderabad', array('multiple'=>'true','style'=>'height: 100px; width: 100px;'), $this->getCitysinIndia());
      ?>

      </td>

      <td style="width: 30px;">
      <input style="width: 120px;" type="button" id="toright" name="toright" value=">>" onclick=" " /><br />
      <input style="width: 120px;" type="button" name="toleft" name="toleft" value= "<<" onclick=" " />
      </td>

      <td>
      <label for="city2">Selected City(s)</label>
      <select id="CityId2" name="CityId2" multiple="multiple" style="height: 100px; width: 100px;">
      //when will click on >> button selected city of first list box data must display in the second list box
      </select>
      </td>



      this is phtml page iam using PHP ...............

      Comment


      • #4
        Re: move data from one listbox to another list box

        This can NOT be the entire script. There must be some backend script and functions that perform the desired actions. Without them i don't think anyone can help you.
        Navaldesign
        Logger Lite: Low Cost, Customizable, multifeatured Login script
        Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
        DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
        Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

        Comment


        • #5
          Re: move data from one listbox to another list box

          my code is

          <td style="width: 100px;"><label for="city1">City(s)</label>
          <br />

          <?php
          $city1 = $_POST['CityId1'];
          if($country)
          echo $this->formSelect('CityId1', $city1, array('multiple'=>'true','style'=>'height: 100px; width: 100px;'), $this->getCitysinIndia());// here i will get all the cites those will be in first list box
          else
          echo $this->formSelect('CityId1', 'Hyderabad', array('multiple'=>'true','style'=>'height: 100px; width: 100px;'), $this->getCitysinIndia());
          ?>

          </td>

          <td style="width: 30px;">
          <input style="width: 120px;" type="button" id="toright" name="toright" value=">>" onclick="moveoutid()" /><br />
          <input style="width: 120px;" type="button" name="toleft" name="toleft" value= "<<" onclick="moveinid()" />
          </td>

          <td>
          <label for="city2">Selected City(s)</label>
          <select id="CityId2[]" name="CityId2[]" multiple="multiple" style="height: 100px; width: 100px;">
          //when will click on >> button selected city of first list box data must display in the second list box
          </select>
          </td>

          <input type="submit" id="save" name="save" value="Save" />


          by using javascript when ever i press >> button i can take out the value from first list box and i can place inside second list box , iam doing same think for << button also

          my javascript code is :

          function moveoutid()
          {
          var selcity1 = document.getElementById('CityId1');;
          var len = selcity1.length;
          var selcity2 = document.getElementById('CityId2');
          for(var j=0; j<len; j++)
          {
          if(selcity1[j].selected)
          {
          var tmp = selcity1.options[j].text;
          var tmp1 = selcity1.options[j].value;
          selcity1.remove(j);
          j--;
          var y=document.createElement('option');
          y.text=tmp;
          try
          {selcity2.add(y,null);
          }
          catch(ex)
          {
          selcity2.add(y);
          }
          }
          }
          }


          function moveinid()
          {
          var selcity1 = document.getElementById('CityId1');
          var selcity2 = document.getElementById('CityId2');
          var len = selcity2.length;
          for(var j=0; j<len; j++)
          {
          if(selcity2[j].selected)
          {
          var tmp = selcity2.options[j].text;
          var tmp1 = selcity2.options[j].value;
          selcity2.remove(j);
          j--;
          var y=document.createElement('option');
          y.text=tmp;
          try
          {
          selcity1.add(y,null);}
          catch(ex){
          selcity1.add(y);
          }

          }
          }
          }
          </script>


          MY QUESTION IS :
          when ever i press Save button it goes to the validation part in server side,
          by using $advCity2 = $_POST['advCity2[]']; i want to take the all the second list box values and save inside the database . but all the values are not coming ? what shall i do?

          any body please help me urgent....

          Comment


          • #6
            how to pass multiple listboxes values to server side?

            MY QUESTION IS :
            i have 2 multiple list boxes , first list box contains 10 cityes , between the listboxes i have two buttons >> and << , when i select >> button i need to take out the value from listbox1 and keep inside the listbox2....

            when ever i press Save button it need to take all the adCity2 values and save inside the database . but iam unable to get adCity2 listbox(2nd listbox )values ... how can i get adCity2 values from browser to serverside to store inside db?


            any body please help me urgent....


            <td style="width: 100px;"><label for="city1">City(s)</label>
            <br />

            <?php
            $city1 = $_POST['CityId1'];
            if($country)
            echo $this->formSelect('CityId1', $city1, array('multiple'=>'true','style'=>'height: 100px; width: 100px;'), $this->getCitysinIndia());// here i will get all the cites those will be in first list box
            else
            echo $this->formSelect('CityId1', 'Hyderabad', array('multiple'=>'true','style'=>'height: 100px; width: 100px;'), $this->getCitysinIndia());
            ?>

            </td>

            <td style="width: 30px;">
            <input style="width: 120px;" type="button" id="toright" name="toright" value=">>" onclick="moveoutid()" /><br />
            <input style="width: 120px;" type="button" name="toleft" name="toleft" value= "<<" onclick="moveinid()" />
            </td>

            <td>
            <label for="city2">Selected City(s)</label>
            <select id="CityId2[]" name="CityId2[]" multiple="multiple" style="height: 100px; width: 100px;">
            //when will click on >> button selected city of first list box data must display in the second list box
            </select>
            </td>

            <input type="submit" id="save" name="save" value="Save" />



            my javascript code is :

            function moveoutid()
            {
            var selcity1 = document.getElementById('CityId1');;
            var len = selcity1.length;
            var selcity2 = document.getElementById('CityId2');
            for(var j=0; j<len; j++)
            {
            if(selcity1[j].selected)
            {
            var tmp = selcity1.options[j].text;
            var tmp1 = selcity1.options[j].value;
            selcity1.remove(j);
            j--;
            var y=document.createElement('option');
            y.text=tmp;
            try
            {selcity2.add(y,null);
            }
            catch(ex)
            {
            selcity2.add(y);
            }
            }
            }
            }


            function moveinid()
            {
            var selcity1 = document.getElementById('CityId1');
            var selcity2 = document.getElementById('CityId2');
            var len = selcity2.length;
            for(var j=0; j<len; j++)
            {
            if(selcity2[j].selected)
            {
            var tmp = selcity2.options[j].text;
            var tmp1 = selcity2.options[j].value;
            selcity2.remove(j);
            j--;
            var y=document.createElement('option');
            y.text=tmp;
            try
            {
            selcity1.add(y,null);}
            catch(ex){
            selcity1.add(y);
            }

            }
            }
            }
            </script>

            Comment


            • #7
              Re: move data from one listbox to another list box



              Once you have finished the Transfer Option, use ABVFP to process your form, so it will automatically store the values in the database.
              Navaldesign
              Logger Lite: Low Cost, Customizable, multifeatured Login script
              Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
              DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
              Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

              Comment


              • #8
                Re: move data from one listbox to another list box

                How can i get OptioTransfer.js file ?

                Comment


                • #9
                  Re: move data from one listbox to another list box

                  Click on "Source" in the link i provided.
                  Navaldesign
                  Logger Lite: Low Cost, Customizable, multifeatured Login script
                  Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
                  DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
                  Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

                  Comment


                  • #10
                    Re: move data from one listbox to another list box

                    iam getting errors like

                    OptionTransfer is not defined

                    and

                    this.originalLeftValues has no properties

                    Comment


                    • #11
                      Re: move data from one listbox to another list box

                      Well, i can't help you with setting up correctly the Javascript. This requires quite a lot of time. I can only suggest that you read carefully the instructions provided by the author.
                      Navaldesign
                      Logger Lite: Low Cost, Customizable, multifeatured Login script
                      Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
                      DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
                      Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

                      Comment


                      • #12
                        Re: move data from one listbox to another list box

                        Thanks i got it...........

                        Comment

                        Working...
                        X