Reputation: 7280
I'm getting a json string with jQuery and then for each value, I add a checkbox.
function dateClick(url){
$.getJSON(url,
function(data){
var row = $("#HourSelectionTable tbody").html();
$("#HourSelectionTable").empty();
$("#HourSelectionTable").append(row);
$.each(data, function(i,data){
if(data.free == 'true'){
$("<tr><td><input id='"+data.date+"-"+data.hour+"' value='"+data.date+"-"+data.hour+"'type='checkbox' onclick='hourClick(this.id);' /></td><td>"+data.hour+"</td></tr>").appendTo("#HourSelectionTable");
}else {
$("<tr><td> </td><td>"+data.hour+"</td></tr>").appendTo("#HourSelectionTable");
}
if ($("#HourSelectionTable").is(":hidden")) {
$("#HourSelectionTable").slideDown("slow");
}
});
});
}
Now, when I post the form and look at $_POST, there is nothing there.
echo ("<pre>");
print_r($_POST);
echo ("</pre>");
Gives:
Array
(
[Submit] => Bevestig
)
How can I solve this?
Dennis
Upvotes: 0
Views: 342
Reputation: 625387
Your form is empty because you're not giving the input fields the name
attribute. The name attribute is what populates the POST HTTP request and then the $_POST
array.
Upvotes: 1