Hi I have some Javascript on my website which allows users to add additional fields to a form. However I am not sure how to add these additional fields to the database.
my code is here, any suggestions on how to generate this into a php variable would be appreciated.
function addField(){
var newContent = "<div class='item'><br><label for='qualification_title'>School Qualification Title</label><input type='text' name='schoolqualificationtitle[]'/></div><div class='item last'><br><label for='qualification_result'>Grade<em>*</em></label><input type='text' id='result' name='schoolqualificationresult[]' />";
$("#myfields").append(newContent);
}
Thanks.
when you post these additional fields the data will be passed to PHP in the array schoolqualificationtitle.
foreach($_POST['schoolqualificationtitle'] as $schoolqualificationtitle){
// do some database shizzle
}
Sounds like ONE user can have SEVERAL items. So this is a one-to-many relationship, meaning you need to add a row for each added item.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.