Please check PHP form post variables thing...

Discussion in 'PHP' started by kyashwanthreddy, May 31, 2010.

  1. #1
    <html>
    <head>
    <script type="text/javascript">
    function checkAll(cnt)
    {
    if(document.getElementById("id_chk_all").checked == true)
    {
    for(var c=1;c<=cnt;c++)
    {
    document.getElementById("id_chk"+c).checked = true;
    }
    }
    else
    {
    for(var c=1;c<=cnt;c++)
    {
    document.getElementById("id_chk"+c).checked = false;
    }
    }
    }
    </script>
    </head>
    <body>

    <?
    echo '<pre>';
    var_dump($_POST);
    if(isset($_POST['chg_pass']))
    {
    $count = $_POST['acc_count'];
    for($i=1;$i<=$count;$i++)
    {
    if(isset($_POST["chk$i"]))
    echo "<br>$i checked";
    else
    echo "<br>$i not checked";
    }
    }
    else
    {
    echo "<form action='' method='post'><input type='checkbox' id='id_chk_all' onclick=\"checkAll('200')\"><br><br>";
    for($i=1;$i<=200;$i++)
    {
    echo "$i<input type='checkbox' name='chk$i' id='id_chk$i'><br>";
    }
    echo "<input type='hidden' name='acc_count' value='200'><input type='submit' name='chg_pass' value='Submit'></form>";
    }
    ?>
    </body>
    </html>

    (Please try to execute my code, so dat u know wats my problem is...)
    wen i run this page it dumping only 200 values, after 200 it is not posting values. In this code submit button is 201 field, so if click sumbit button, submit action is not doing. can anyone tell why ???
     
    kyashwanthreddy, May 31, 2010 IP
  2. actress143

    actress143 Peon

    Messages:
    132
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    are you using shorthand enabled...., servers
     
    actress143, May 31, 2010 IP
  3. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #3
    Try this else

    
    
    <html>
    <head>
    <script type="text/javascript">
    function checkAll(cnt)
    {
    if(document.getElementById("id_chk_all").checked == true)
    {
    for(var c=1;c<=cnt;c++)
    {
    document.getElementById("id_chk"+c).checked = true;
    }
    }
    else
    {
    for(var c=1;c<=cnt;c++)
    {
    document.getElementById("id_chk"+c).checked = false;
    }
    }
    }
    </script>
    </head>
    <body>
    
    <?php
    echo '<pre>';
    var_dump($_POST);
    if(isset($_POST['chg_pass']))
    {
    $count = $_POST['acc_count'];
    for($i=1;$i<=$count;$i++)
    {
    if(isset($_POST["chk$i"]))
    echo "<br>$i checked";
    else
    echo "<br>$i not checked";
    }
    }
    else
    {
    echo "<form action='' method='post'><input type='checkbox' id='id_chk_all' onclick=\"checkAll('200')\"><br><br>";
    for($i=1;$i<=200;$i++)
    {
    echo "$i<input type='checkbox' name='chk$i' id='id_chk$i'><br>";
    }
    echo "<input type='hidden' name='acc_count' value='200'><input type='submit' name='chg_pass' value='Submit'></form>";
    }
    ?>
    </body>
    </html> 
    
    
    PHP:
     
    roopajyothi, Jun 1, 2010 IP