Jquery mutiple fields

what i use to make a form like this that user can add automatic multiple input fields how much they want then i can get the data of all
here is demo
www.ukash2paypal.com/

m also notice one more thing in source that form action is going in cgi-bin folder
is there any already created code relative to this :S or any can help to make like this that

Here’s a suitable tutorial:
jQuery - Dynamically Adding Form Elements

The cgi-bin folder is for server-side scripting, similar to PHP code. cgi-bin is an ancient form of it that commonly uses PERL as the scripting language.

These days, you will want to use PHP or ASP or some other more relevant server-side scripting solution.

how i get values which condition i apply on loop
that i don’t need to mention these separelty autmatic how much input field user increase my loop also increas and change value in $_POST[‘name’]–>[change this value auto]
instead of i have to write it separetly like this

$one = $_POST[‘name’][0];
$two = $_POST[‘name’][1];
$thre = $_POST[‘name’][2];
$for = $_POST[‘name’][3];

well don’t know much about jquery
but everything is going good i can get values of each input using
$one = $_POST[‘name’][0];
$two = $_POST[‘name’][1];
$thre = $_POST[‘name’][2];
$for = $_POST[‘name’][3];

but just want to know if i use for loop
like this
for ($i=1; $i<=5; $i++){
$_POST[‘name’][$1]
}
which condition i use $1<= instead of 5 because i don’t know the exact inputs which user give ???

Using the tutorial as an example:

You can use the array_keys function and loop through them all checking that the key matches what you’re after


$name = array();
foreach($_POST as $key => $value) {
    if (substr($key, 0, 4) === 'name') {
        $name[] = $value;
    }
}

or you can use a while loop that carries on getting the next appropriate form value while one still exists.


$name = array();
$index = 0;
while (isset($_POST['name'] . $index)) {
    $name[] = $_POST['name' . $index];
}

You’re lucky getting this type of code here, as this is the JavaScript forum.
Please post a new thread to the PHP forum for further PHP code support.

why ur second one php code give errror

I shouldn’t be replying now, it’s 1:30am, but possibly because there’s a missing bracket. No, it’s because this is the JavaScript forum and I’ve been using JavaScript concatenators when instead PHP concatenators should be used. The code is updated now.

I knew I shouldn’t have posted PHP code in the JavaScript forum.