Welcome Guest, Not a member yet? Register   Sign In
dynamic input with jquery and insert to database
#1

(This post was last modified: 11-15-2021, 01:43 PM by Secux.)

I have the following form
PHP Code:
<form>
<
input type="text" name="title" placeholder="Enter your Title" class="form-control" />

<
table class="table table-bordered" id="dynamicTable">  
            
<tr>
                <th>Name</th>
                <th>Level</th>

                <th>Action</th>
            </tr>
            <tr>  
                
<td><input type="text" name="dynamic[0][name]" placeholder="Enter your Name" class="form-control" /></td>  
                
<td><input type="text" name="dynamic[0][level]" placeholder="Enter your Level" class="form-control" /></td>
                <td><button type="button" name="add" id="add" class="btn btn-success">Add More</button></td>  
            
</tr
</
table
<
button type="submit" id="" class="btn btn-success"Create </button>
</
form

How to take and save data from "name = dynamic"

PHP Code:
$details = [
    'title' => $this->request->getVar('title'),
    'dynamic' => $this->request->getVar('dynamic')
];

$this->NewsDetails->save($details); 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB