How to Fetch Dynamic input field array items value with different name php mysql? -
i have form below:
<form id="bookform" method="post" class="form-horizontal"> <div class="form-group"> <label class="col-xs-1 control-label">book</label> <div class="col-xs-4"> <input type="text" class="form-control" name="book[0].title" placeholder="title" /> </div> <div class="col-xs-4"> <input type="text" class="form-control" name="book[0].isbn" placeholder="isbn" /> </div> <div class="col-xs-2"> <input type="text" class="form-control" name="book[0].price" placeholder="price" /> </div> <div class="col-xs-1"> <button type="button" class="btn btn-default addbutton"><i class="fa fa-plus"></i></button> </div> </div>
how value of form in php $_post
because name of fields <br/>name="book[0].title"**<br/>
?
and there many dynamic different name input fields.
if want use same form change name of textbox like,
<form id="bookform" method="post" class="form-horizontal"> <div class="form-group"> <label class="col-xs-1 control-label">book</label> <div class="col-xs-4"> <input type="text" class="form-control" name="book[0][title]" placeholder="title" /> </div> <div class="col-xs-4"> <input type="text" class="form-control" name="book[0][isbn]." placeholder="isbn" /> </div> <div class="col-xs-2"> <input type="text" class="form-control" name="book[0][price]" placeholder="price" /> </div> <div class="col-xs-1"> <button type="submit" class="btn btn-default addbutton"><i class="fa fa-plus"></i></button> </div> </div>
and value of form echo $_post['book'][0]['title'];
i hope can you.
Comments
Post a Comment