How can i insert this data using php & MySQL? User can insert more than one data for name and nationality.Im using javascript function for user to add multiple data.Hope someone can help me.Im not sure i should use foreach or not.HTML Code:<script language="javascript"> fields = 0; function addInput() { if (fields != 10) { document.getElementById('text').innerHTML += "<span class='teks03'>Name</span> : <input type='text' value='' name='name[]' size='30' class='mybox' /> <span class='teks03'>Nationality</span> : <input type='text' value='' name='nationality[]' size='30' class='mybox' /><br><input type='button' onClick='addInput()' name='add' value='Add' /><br>"; fields += 1; } else { document.getElementById('text').innerHTML += "<br />Maximum 10 fields allowed."; document.frm.add.disabled=true; } } </script><table cellpadding="0" cellspacing="0" align="center"> <tr> <td height="15"></td> </tr> <tr> <td> <form method="post" name="frm" action="add.php"> <table cellpadding="1" cellspacing="0" width="100%" align="center"> <tr> <td><b>Board of Directors</b></td> </tr> <tr><td> </td><td></td></tr> <tr> <td colspan="2"><span class="teks03">Name</span> : <input type="text" class="mybox" name="name[]" value="" size="30" /> <span class="teks03">Nationality</span> : <input type="text" class="mybox" name="nationality[]" value="" size="30" /><br /> <input type="button" onClick="addInput()" name="add" value="Add" /><br /> <div id="text"></div> </td> <tr> <td width="277"></td> <td width="694"> <input type="submit" name="sub" size="12" value="Submit"> <input type="reset" name="reset" value="Reset" size="12"></td> </tr> </tr> </table> </form> </td> </tr> </table>


Reply With Quote
Bookmarks