Otavio Alenski Otavio Alenski - 7 months ago 15
jQuery Question

Multiple values inside form php/query

Before I start, I want to say that I used the search function but none of the other questions helped me.

I found a code that fits what I need (here) but there is a is when I try to retrieve the values.

// Edit

Assuming that i'am using exactly the some code, how to retrieve the values?

The code above is to show what happen when user click in the plus button.

<form method='post' name='form'>
<input type="text" name="username[0]'>
<input type="password" name="password[0]">

// new added fiels using the jquery
<input type="text" name="username[1]'>
<input type="password" name="password[1]">

Using a form like this, how to retrieve the values one by one?

<?php if (isset($POST['submit'])) { // what to do here? }?>

I ask this question because I want to store the values on a sql database, and I need the separated values like:

User 1 - user & pass

User 2 - user & pass

To use this on a php function that receive the

Sk_ Sk_
<form method='post' name='form'>
<input type="text" name="username['username'][]'>
<input type="password" name="password['password'][]">
// new added fiels using the jquery
<input type="text" name="['username'][]'>
<input type="password" name="password['password'][]">
<input type = "submit" name="submit" value="Submit" />

$postData = $_POST;  
for($i = 0; $i < count($postData);$i++){
    $username = $postData['username'][$i];
    $password = $postData['password'][$i];