I have a form that allows the user to add more fields to them. When the user does this, then two more fields appear (one for link text, another for link address). I use javascript to add a number to input names (like I want to see if the use of variables in my mailing array is prefix The correct approach will be to name the field as an array: then using your JS code Add only one of the two fields with the same name ( Do not forget to avoid price before saving the DB newLinkTitle1 +
newLinkAddress1 ,
newLinkTitle2 +
newLinkAddress2 I am, etc.).
& lt; Input type = "text" value = "" name = "newLinkTitle" size = "50" /> & Lt; Input type = "text" value = "http: //" name = "new link order" size = "50" />
newLinkTitle and then get associated with it
newLinkAdress
newLinkTitle [] and
NewLinkAddress [] :
input type = "text" value = "" name = "new linkitit []" size = "50" />
newLinkTitle [] and
newLinkAddress [] ). And in PHP, just do something like this:
foreach ($ _Post ['newLinkTitle'] as $ key = & gt; $ val) $ $ currentNewLinkTitle = $ val; $ CurrentNewLinkAddress = $ _POST ['newLinkAddress'] [$ K]; // to save the DB)
No comments:
Post a Comment