1

I build an app but I found new problem, I want to insert multiple data using javascript to add more form dynamically (then insert into table). Okay in my FIGURE, number 1,2,3 that's clear. But when I insert into the table , it can't succesfully. (number 4 is my function to insert data, but all of may form cannot insert (number 5) , only 1 data can insert ). what's wrong ? thanks

FIGURE

3
  • whats your Question?? Commented Apr 16, 2015 at 6:05
  • You need to update last change field?? Commented Apr 16, 2015 at 6:06
  • Example: when I add more form -> 10 form, I will insert 10 data's, but now, I only can insert 1 data. I guess I got wrong in my count($_POST). But what? Commented Apr 16, 2015 at 6:11

1 Answer 1

1

use for loop like this, your $_POST must be under loop.

for ($i = 0; $i < count($_REQUEST['heading']); $i++) {
                    $heading = $_POST["heading"][$i];
                    $address = $_POST["address"][$i];
                    $array_addmore[$i] =
                        array(
                            "heading" => urlencode($heading),
                            "address" => urlencode($address)
                        );
                }
Sign up to request clarification or add additional context in comments.

2 Comments

I got an error like A Database Error Occurred You must use the "set" method to update an entry. Filename: C:\wamp\www\SMU\system\database\DB_active_rec.php Line Number: 1174
what is your update statement ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.