javascript
  • php
  • jquery
  • jquery-mobile
  • checkboxlist
  • 2014-03-04 19 views 0 likes 
    0

    我想獲得複選框組的在PHP代碼 jQuery的移動代碼Jquery的移動應用程序的值(我發現樣品例如在此jQuery的移動複選框組此鏈接 http://jsfiddle.net/Palestinian/2yjgg/得到在PHP代碼Jquery的移動複選框組值

    <div data-role="page" id="attend" > 
    <p>Choose Student who attende:</p> 
    <div id='group_checkboxes'></div> 
    <form method="post" action="sign_up3.php" target="_new" > 
    <script> 
    $("#attend").live("pageinit",function(event){ 
    
    var checkboxes = ''; 
    for (i = 0; i <= 5; i++) { 
    checkboxes += '<input type="checkbox" id="foo' + i + '" class="custom" name="attend_list[]" /><label for="foo' + i + '">Foo checkbox' + i + '</label>'; 
        } 
        var controlgroup = $("<fieldset/>", {"data-role": "controlgroup"}).append(checkboxes); 
        $("#group_checkboxes").append(controlgroup.controlgroup()); 
        $("[type=checkbox]").checkboxradio(); 
        $("[data-role=controlgroup]").controlgroup("refresh"); 
        });      
    
    </script> 
        <input type="submit" value="submit" > 
    
        </form> 
    </div> 
    

    PHP代碼

    <?php 
    
        foreach($_POST['attend_list'] as $value) 
        { 
        echo $value ; 
        } 
    
        ?> 
    

    但提交的PHP代碼顯示此錯誤時

    「注意:未定義的索引:位於第3行的C:\ xampp \ htdocs \ att \ sign_up3.php中的attend_list

    警告:爲C:\ xampp \ htdocs \ att \ sign_up3.php中的foreach在第3行「

    +0

    我在這個鏈接中找到它 http://jsfiddle.net/Palestinian/2yjgg/ – Beshoy

    回答

    0

    移動這樣的:

    <div id='group_checkboxes'></div> 
    

    到表單中。 I.E.

    <form method="post" action="sign_up3.php" target="_new" > 
    

    它目前正在寫的內容不包括在表格的複選框的方式,所以當它提交,其數據不與表單提交一起傳遞:此行之後。

    相關問題