tags:

views:

34

answers:

1

Hello,

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>&nbsp;</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

+1  A: 

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.

cletus
OMG!!!! Didn't see that. Let's try!
Dennis Decoene
Jup that did it!
Dennis Decoene