Hello, I am working on a website where the user can fill out a long form. For simplicity reasons, a part asks them to list features they would like to see. For that I plugged in some javascript to make a "[more]" link to add more form fields. Each form field is given a name like feature1, feature2, and so on, depending on how many times they clicked it. Anyways, how would I process that in PHP to make it all go into one row inside my database? How would I tell it to process and group all those fields.Remember, the only difference between those fields is the number at the end
epicrevolt 6 Junior Poster in Training
Recommended Answers
Jump to PostIn my opinion the best way to do this would be to name your fields using an array index.
<input name="field[]" type="text" size="20" maxlength="40" /> <input name="field[]" type="text" size="20" maxlength="40" /> <input name="field[]" type="text" size="20" maxlength="40" />
Then when you process the fields with PHP it is …
All 3 Replies
chrishea 182 Nearly a Posting Virtuoso
epicrevolt commented: Solved my problem, I love you :) +1
mschroeder 251 Bestower of Knowledge Team Colleague
epicrevolt commented: Defninitely a new method. I need to look more into arrays for my projects. +1
epicrevolt 6 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.