lznogud,
I have done a few changes to your code and accordingly you need to do some in the php file i.e testProces.php
http://jsfiddle.net/mNkub/
$('#addScnt').live('click', function() {
$('<label for="ticketCantidad"><input type="text" id="ticketCantidad" size="20" name="ticketCantidad[' + i +']" value="" placeholder="Valor de Tickets" /></label>').appendTo(scntDiv);
//i++;
$('<label for="ticketValue"><input type="text" id="ticketValue" size="20" name="ticketValue[' + i +']" value="" placeholder="Cantidad de Tickets" /></label><p></p>').appendTo(scntDiv);
i++;
return false;
});
Now the html structure you get will be
<input type="text" id="ticketCantidad" size="20" name="ticketCantidad[2]" value="" placeholder="Valor de Tickets">
<input type="text" id="ticketValue" size="20" name="ticketValue[2]" value="" placeholder="Cantidad de Tickets">
then next one will be :
<input type="text" id="ticketCantidad" size="20" name="ticketCantidad[3]" value="" placeholder="Valor de Tickets">
<input type="text" id="ticketValue" size="20" name="ticketValue[3]" value="" placeholder="Cantidad de Tickets">
and so on
now in the php file you will get two arrays with both fields data in same key in POST. Then you can do the coding as follows :
if(isset($_POST["ticketCantidad"]) && count($_POST['ticketCantidad'])>0) {
foreach($_POST["ticketCantidad"] as $key => $value) {
$cantidad = $value;
$value = $_POST["ticketValue"][$key];
$query = "INSERT INTO `tickets` SET `name` = $cantidad, `date` = $value";
mysql_query($query);
}
}
Hope this will clears the picture.
PS : you may need to do some tweaking in code above as i have not tested it, just writing it in one go.