Jump to content

Dynamic extend form


shamsuljewel

Recommended Posts

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.

Link to comment
Share on other sites

 

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. :D

 

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 ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.