Form Page:form.php
Expand|Select|Wrap|Line Numbers
- <head>
- <script language="JavaScript">
- function addSrcToDestList() {
- destList1 = window.document.forms[0].destList;
- srcList = window.document.forms[0].srcList;
- var len = destList1.length;
- for(var i = 0; i < srcList.length; i++) {
- if ((srcList.options[i] != null) && (srcList.options[i].selected)) {
- //Check if this value already exist in the destList or not
- //if not then add it otherwise do not add it.
- var found = false;
- for(var count = 0; count < len; count++) {
- if (destList1.options[count] != null) {
- if (srcList.options[i].text == destList1.options[count].text) {
- found = true;
- break;
- }
- }
- }
- if (found != true) {
- destList1.options[len] = new Option(srcList.options[i].text);
- len++;
- }
- }
- }
- }
- // Deletes from the destination list.
- function deleteFromDestList() {
- var destList1 = window.document.forms[0].destList;
- var len = destList1.options.length;
- for(var i = (len-1); i >= 0; i--) {
- if ((destList1.options[i] != null) && (destList1.options[i].selected == true)) {
- destList1.options[i] = null;
- }
- }
- }
- function allSelect()
- {
- List = document.forms[0].destList;
- if (List.length && List.options[0].value == 'temp') return;
- for (i=0;i<List.length;i++)
- {
- List.options[i].selected = true;
- }
- }
- </SCRIPT>
- </head>
- <body>
- <form name="upload" id="upload" ENCTYPE="multipart/form-data" method="POST" action="<?php $_SERVER['PHP_SELF']?>" onSubmit="allSelect();">
- <select name="srcList" multiple size=10 style="width:150;" onChange="moveOver();">
- <option value ="0" >Admin</option>
- <option value ="1" >Public</option>
- <option value ="2" >Private</option>
- <option value ="3" >All</option>
- </select>
- <input type="button" value=" >> " onClick="javascript:addSrcToDestList()">
- <br>
- <br>
- <input type="button" value=" << " onClick="javascript:deleteFromDestList();">
- <select name="destList[]" size=10 style="width:150;" multiple >
- </select>
- <input type="submit" class="button3" name="upload" value="Insert" >
- </body>
Expand|Select|Wrap|Line Numbers
- <?
- $result2 = mysql_query("insert into
- ccms_table values(' " . join(",",$_POST["destList"]) ." ' ) );
- ?>
Please give the solution.Thanks to all advance.