This is my display form
<form name='foodlist' action='checkout' method='POST'>
<table>
<tr>
<td>Product Name</td>
<td>Price</td>
<td>Quantity</td>
<td>Amount</td>
</tr>
<tr>
<td><input type='text' name='foodname[]' size='10' class='foodname' /></td>
<td><input type='text' name='price[]' size='2' class='price'/></td>
<td><input type='text' name='qty[]' size='2' class='qty'/></td>
<td><input type='text' name='amt[]' size='2' class='amt'/></td>
</tr>
<tr>
<td><input type='text' name='foodname[]' size='10' class='foodname' /></td>
<td><input type='text' name='price[]' size='2' class='price'/></td>
<td><input type='text' name='qty[]' size='2' class='qty'/></td>
<td><input type='text' name='amt[]' size='2' class='amt'/></td>
</tr>
</table>
</form>
I have AJAX jQuery to get input values.
$.ajax({
type : "POST",
url : "ajaxfood.php",
data: $('[name="qty[]"]').serialize(),
success : function(html) {
alert (html);
}
});
This is my php:
<?php
$qtys = $_POST['qty'];
echo json_encode($qtys);
?>
The above code is working perfectly and displaing the qty array. But my problem is I want to get all the textboxes in my php. I tried to send the while form but it won't worked
data: $('form').serialize(),
- What is the way to send the whole form data.
- and how to get it php.
- and how to put the result in a div.
My first question is very important for me. please help