shamsuljewel Posted January 30, 2008 Share Posted January 30, 2008 I am using a form that is sale form for a shop. A user can sale as much item as s/he need. By default I use only one row contain 3 fields as product name, quentity and price..and there should be a link for Add another...if s/he click add another it will be another row like previous under below. so how can I do this by javascript and after submittinf the form I want to save the info into my mysal database by php. any help or guide line will be appritiated. Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted January 30, 2008 Share Posted January 30, 2008 Well here is the javascript side of it; you will have to get someone else to help you with the php side, to tired too get into that tonight. I suggest posting a question regarding this type of form processing in the PHP forum on this site. Which Is Located Here: http://www.phpfreaks.com/forums/index.php/board,1.0.html Here's You JavaScript: <script language="javascript"> var i = 0; function addMore() { i=i+1; document.getElementById("fields").innerHTML += "\nItem "+i+": <input type=\"text\" name=\"saleitem"+i+"\"><br><br>" } window.onload = function() { addMore(); } </script> <div id="fields"></div> <br/><br/> <input type="button" value="Add Another Sale Item" onclick="addMore()"> Good Luck Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.