I’m stuck, I want to insert form data from array fields like below into MySQL:
<input type='text' name='name[]' />` and `<input type='text' name='url[]' />
I know how to output the data for one field like this example
foreach($_POST['name'] as $name)
{
echo $name;
}
But in my form I have both <input type='text' name='name[]' /> and <input type='text' name='url[]' /> how can I get this to work correctly?
I would try and avoid querying the DB over and over and just put everything in one big insert statement:
That way you only have to hit the database once, making the insert much faster.
An other benefit is that if the engine supports transactions (InnoDB et al) all inserts happen in a single transaction.