retrieve data from Oracle on basis of <input type="checkbox"

Discussion in 'PHP' started by bolat, Aug 6, 2009.

  1. #1
    Hi everybody! Please, help me with retrieving data from DB. what we have:
    1. index.html, below:
    <html>
    <body>
    <form action="index.php" method="post">
    <input name="month[]" type="checkbox" value = "Junuary">
    <strong> Junuary</strong><br>
    <input name="month[]" type="checkbox" value = "February">
    <strong> February</strong><br>
    <input name="month[]" type="checkbox" value = "March">
    <strong> March</strong><br>
    <input name="shape" type="submit" GO">
    </form>
    </body>
    </html>

    2. index.php
    ...//connect to db
    ...//select data
    <TABLE cellspacing="0" cellpadding="0" alt="" border="0" class="checklist">
    <?php if ($_POST['month']) echo'
    <TR>
    <Th width=80>Dog</B></Th>
    <Th width=300><B>Organization</B></Th>'; else echo '<h3>No one month checked!';?>
    <?php if ($_POST['month']) {$month = $_POST['month']; foreach($month as $value) echo '<Th width=80>'.$value.'</Th>';}?>
    <?php echo '</TR>'; ?>

    <?php while($row = oci_fetch_array($stmt)){ ?>

    <TR>
    <?php if ($_POST['month']) {
    echo '<TD align= right >'.$row['DOG'].'</TD>';
    echo '<TD align= left>'.$row['PUCH'].'</TD>';
    }?>
    <?php for ($i=1; $i<=9; $i++) {echo '<TD align= right><b>'.number_format($row['C'.$i], 2, ',', ' ').'</b></TD>'; } ?>

    </TR>
    <?php } ?>

    </TABLE>

    I can't make to display clomuns which checked in <input type="checkbox">
    For example: I want see value from Junuary and March, accordingly checkeing Junuary and March in input element. How can I write a script to display data of 2 months. $row[c1] is number. Headers excellent works!
    A bit of code you want to edit marked as red.
     
    bolat, Aug 6, 2009 IP
  2. bolat

    bolat Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    hey php geeks, does anybody understand problem?:(
     
    bolat, Aug 7, 2009 IP