Jump to content

How can I save two list boxes at the same time?


eskio

Recommended Posts

I want to transfer 1 or many items from the first list to the second and save.

How can I save the two list boxes at the same time? ???

 

here is my code:

 

<script language="javascript" type="text/javascript">

function TransferList(l1,l2) {

if (l1.options.selectedIndex>=0) {

o=new Option(l1.options[l1.options.selectedIndex].text,l1.options[l1.options.selectedIndex].value);

l2.options[l2.options.length]=o;

l1.options[l1.options.selectedIndex]=null;

}else{

alert("Please select a course");

}

}

</script>

 

<?php

if (isset($_POST['cmdSave'])){

 

} // if (isset($_POST['cmdSave']))

?>

  <form name="frmCourse">

    <table>

      <tr>

        <td align="center"><strong>Courses</strong><br />

            <select name="CoursesList1" size=6  style="width:120px">

              <option value="C++">C++</option>

  <option value="VB6">VB6</option>

              <option value="VB.NET">VB.NET</option>

              <option value="C#">C#</option>

              <option value="PHP">PHP</option>

              <option value="Delphi">Delphi</option>

          </select>

        </td>

        <td align="center">

          <input type="button" value="Add >>>" onClick="TransferList(this.form.CoursesList1,this.form.CoursesList2)">

          <br /><br />

          <input type="button" value="<<< Delete" onClick="TransferList(this.form.CoursesList2,this.form.CoursesList1)">

        </td>

        <td align="center"><strong>Courses</strong><br />

            <select name="CoursesList2" size=6 style="width:120px">

          </select>

        </td>

      </tr>

    </table>

    <input name="cmdSave" type="submit" value="Save">

  </form>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.