views:

64

answers:

0

Hi,

I am developing a site in php.

i have some issues with my form

i have to more than one software packages at a time.

so i have used javascript to append file and a dropdown to my html.

i have called ajs function to add the new input fields each time when i click a link.

and its displaying correctly.

but its not identifying in my action page.

i cant take the value of new input fields which i have created through that javascript function.

below is the code page which i have used.

<script language="JavaScript">

function addInput(divName){

  var newsel= document.createElement('div');
         newsel.innerHTML="<div style='padding-left:55px;padding-top:10px';>Operating System: <select name='frm_os1' id='test1' ><option value=''>--Select OS--</option><optgroup label='Spind Enabled'> </optgroup><option value='bc_linux'>&nbsp;&nbsp;&nbsp;bc_linux</option><optgroup label='Packages'> </optgroup><option value='Linux'>&nbsp;&nbsp;&nbsp;Linux</option><option value='Solaris'>&nbsp;&nbsp;&nbsp;Solaris</option><option value='2000/XP/Vista'>&nbsp;&nbsp;&nbsp;2000/XP/Vista</option><option value='XP/Vista'>&nbsp;&nbsp;&nbsp;XP/Vista</option><option value='2K/XP/Vista/W7'>&nbsp;&nbsp;&nbsp;2K/XP/Vista/W7</option><option value='HP'>&nbsp;&nbsp;&nbsp;HP</option><option value='Windows 2000/XP/Vista zip'>&nbsp;&nbsp;&nbsp;Windows 2000/XP/Vista zip</option><option value='Windows 2000/XP/Vista exe'>&nbsp;&nbsp;&nbsp;Windows 2000/XP/Vista exe</option><option value='X Server - 2.2M'>&nbsp;&nbsp;&nbsp;X Server - 2.2M</option><option value='Fonts - 32.9M'>&nbsp;&nbsp;&nbsp;Fonts - 32.9M</option></select></div>";
         document.getElementById(divName).appendChild(newsel);

          var newdiv = document.createElement('div');
          newdiv.innerHTML = "<div style='padding-left:40px;padding-top:10px';>Upload Software File: <input type='file' name='frm_image1' class='text_area'></div>";
          document.getElementById(divName).appendChild(newdiv);

}



</script>
</HEAD>

                                          <form action="act-add-software.php" method="post" onSubmit="return validate(this);" enctype="multipart/form-data">




                                                  <select name="frm_os"  class="text_area" style="width:200px">
                                                        <option value="">--Select OS--</option>
                                                            <optgroup label="Spind Enabled"> </optgroup>
                                                            <option value="bc_linux">&nbsp;&nbsp;&nbsp;bc_linux</option>
                                                            <optgroup label="Packages"> </optgroup>
                                                            <option value="Linux">&nbsp;&nbsp;&nbsp;Linux</option>
                                                            <option value="Solaris">&nbsp;&nbsp;&nbsp;Solaris</option>
                                                            <option value="2000/XP/Vista">&nbsp;&nbsp;&nbsp;2000/XP/Vista</option>
                                                            <option value="XP/Vista">&nbsp;&nbsp;&nbsp;XP/Vista</option>                                                            
                                                            <option value="2K/XP/Vista/W7">&nbsp;&nbsp;&nbsp;2K/XP/Vista/W7</option>                                                            
                                                            <option value="HP">&nbsp;&nbsp;&nbsp;HP</option>                                                            
                                                            <option value="Windows 2000/XP/Vista zip">&nbsp;&nbsp;&nbsp;Windows 2000/XP/Vista zip</option>                                                          
                                                            <option value="Windows 2000/XP/Vista exe">&nbsp;&nbsp;&nbsp;Windows 2000/XP/Vista exe</option>
                                                            <option value="X Server - 2.2M">&nbsp;&nbsp;&nbsp;X Server - 2.2M</option>
                                                            <option value="Fonts - 32.9M">&nbsp;&nbsp;&nbsp;Fonts - 32.9M</option>                                                                                                                                                                                  
                                                            </select>
                                                            <a onClick="addInput('dynamicInput');">Add More Package</a> </td>
                                                  </td>
                                                </tr>
                                                <tr>
                                                  <td colspan="2"><table border="0" cellpadding="0" cellspacing="0">
                                                      <tr align="center" valign="middle" class="tbl_row1">

                                                        <td height="25" align="left" class="font1" width="156" bgcolor="White"><div align="right">
                                                            <?if(strstr($frm_server_side_error,'frm_software')){?>
                                                            <font class="error"><b> <font color="#dd0000">*</font>&nbsp;Upload Software File: </font>
                                                            <?}else{?>
                                                            <font class="form_element"> <font color="#dd0000">*</font>&nbsp;Upload Software File:
                                                            <?}?>
                                                          </div>
                                                          </B> </td>

                                                        <td  class="font1"  bgcolor="White" align="center" style="padding-left:2px;"><input type="file" name="frm_image[]" class="text_area">
                                                        </td>
                                                        <?if($frm_sfile !=""){?>
                                                        <td  class="font1"  bgcolor="White" align="center"></td>
                                                        <?}else{?>
                                                        <td  class="font1"  bgcolor="White" align="center">&nbsp;(Current File: NOT Uploaded Yet) </td>
                                                        <?}?>
                                                      </tr>
                                                    </table></td>
                                                </tr>

                                                <tr>
                                                <td colspan="2">
                                                <div id="dynamicInput">
                                                </div>
                                                </td>
                                                </tr>

                                          </form>

For the simplicity of viewing this code page i have included only required code lines

please help me to solve this issueenter code here