hi guyz, i'm new to PHP and my first time to post here..
i would like to ask some help regarding CHECKBOXES..
..I'm havng problem on displaying the values of the checked checkboxes to other pages...how would i do that?

HERE IS MY CODE FOR THE FIRST PAGE:

<?php
                        $sql = "select * from tbl_services";
                        $query=@mysql_query($sql) or die("SQL Error");

                    while($row=@mysql_fetch_array($query))
                    {
                        $_i++; //increments the number in the tbl_services


                        echo "<tr >";
                            echo "<td>";
                                echo $row["ServiceCode"];
                            echo "</td>";
                            echo "<td>";
                                echo $row["ServiceName"];
                            echo "</td>";
                            echo "<td align='center'>";
                                echo "<input type='checkbox' name='check".$_i."' >";
                            echo "</td>";
                        echo "</tr >";
                    }
                    echo"<input type='hidden' name='ServiceID".$_i."' value='".$row["ServiceID"]."'>";
                    echo "<input type='hidden' names' value='".$_i."'>";
            ?>

MY CODE FOR THE ACTION PAGE:

<?php

    ob_start();
    require_once("header.php");

    $_count=$_GET["count"];
    $_service = $_POST["check"];

    for($_i=1;$_i<=$_count;$_i++)
    {
        $_check=$_GET["check".$_i];
        if($_check=="on")
        {
            $_ServiceID=$_GET["ServiceID".$_i];
            echo $_ServiceID;
        }
    }

?>
Member Avatar for P0lT10n

Hello, first of all NEVER call a variable $_NAME NEVER, do $NAME... Modify this and post again your code but between CODE-tags.

And i found an error here

echo"<input type='hidden' name='ServiceID".$_i."' value='".$row["ServiceID"]."'>";

Do this

echo "<input type='hidden' name='ServiceID".$i."' value='".$row['ServiceID']."'>";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.