SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2011
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    View total quantity summer from checkbox selsected items in php & mysql.

    Dear All

    I have a table with style no, order qty etc.

    I can retrieve data from mysql to a html page with checkbox (id) field.

    Now I want to select two or more row with checkbox & want to get a new page with selected row's total quantity.

    Is it possible to do in php? If possible kindly help, how to do?

    Mehidy

  2. #2
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes it is possible, but to be able to help tell you how we will need to see your code.

  3. #3
    SitePoint Member
    Join Date
    Jun 2012
    Location
    Iligan City, Philippines
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Agree...show us your code

  4. #4
    SitePoint Enthusiast
    Join Date
    Mar 2011
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here is my code..some field remove to make it small.

    PHP Code:

    <?php include("password_protect.php"); ?>
    <html>

    <head>

    <title>View orders details</title>

    </head>

     <body>

    <form name="form1" action="checkboxqty.php" method="post"> 
    <table id="tblSearch" cellpadding="2" cellspacing="0" border="0" style="width:3000px;">

    <tr style="font-weight:bold;" bgcolor="#817679">
    <td>#</td>
    <td>Style No</td>
    <td>Days To Go</td>

    <td>Buying House</td>
    <td>Buyer</td>
    <td>Department</td>
    <td>Department For</td>

    <td>Shipment Date<br/><font style="color: #666666; font-size: 50%;">YYY-MM-DD</font></td>
    <td>Ship Mood</td>

    <td>Fabrics Booking Ref</td>
    <td>Quantity</td>
    </tr>
     <?php
    require("connect.php");
    $buyh $_POST['buyh'];
    $ship_status $_POST['ship_status'];
    $c substr("$ship_status", -1); 
    $query="SELECT * FROM tbl_order, tbl_buyr, tbl_fact1, tbl_ord2 
    WHERE buyh ='
    $buyh
    AND tbl_order_id=buyr_tbl_order_id 
    AND tbl_order_id=fact1_tbl_order_id 
    AND tbl_order_id=order2_tbl_order_id
    AND ship_status = '
    $c' ORDER BY shipmentdate, buyh, buyr, artstyl_no ASC";

    $result=mysql_query($query);

    $num=mysql_numrows($result);

    mysql_close();
    ?>


    <?php
    $i
    =0;
    while (
    $i $num) {
    $f6=mysql_result($result,$i,"buyh");
    $f1=mysql_result($result,$i,"buyr");
    $f99=mysql_result($result,$i,"depnn");
    $f12=mysql_result($result,$i,"depf");
    $f7=mysql_result($result,$i,"artstyl_no");
    $f2=mysql_result($result,$i,"order_no");
    $shipdate=mysql_result($result,$i,"shipmentdate");
    $fdate=strtotime($shipdate);
    $f3=date("j-M-y"$fdate);

    //$f4= date("Y-m-d");
    $f4date("F j, Y"); 

    $start=strtotime($f4);

    $end=strtotime($shipdate);

    $sum=$end-$start;

    $result1=floor($sum/86400);
    $f5="$result1";


    $f10=mysql_result($result,$i,"orderqty");
    $f47=mysql_result($result,$i,"tbl_order_id");

    $startw=strtotime($shipdate);
    $f400gdate("Y-m-d");

    $endy=strtotime($f400g);

    $sume=$endy-$startw;

    $result13=floor($sume/86400);
    $f5e substr("$result13"04);


    $color_one '#ffffff';
    $color_two '#ccffff';
    $color = (is_int($i 2)) ? $color_one $color_two;


    ?>


    <tr bgcolor="<?=$color?>" onmouseover="this.style.background='#00ccff';" onmouseout="this.style.background='';" onClick="HighLightTR(this,'#c9244a','cc3333');">


    <td><input name="id[<?php echo $rows['tbl_order_id']; ?>]" type="checkbox"  value="<?php echo $rows['tbl_order_id']; ?>"></td>

    <td style="background-color:#FFF;">
    <span class="class3">
    <a href="ddupdateano.php?tbl_order_id=<?php echo $f47?>" target="_blank"><?php echo $f7?></a>
     </span>
    </td>
    <?php
    if($f5>60) {
        
    // Display RED
    ?>
    <td valign="middle" style="background-color:#0F0;"><?php echo $f5?></td>
    <?php
    } elseif($f5>30 && $f5<61) {
        
    // Display YELLOW
    ?>
    <td valign="middle" style="background-color:#FF0;"><?php echo $f5?></td>
    <?php
    } elseif($f5<0) {
        
    // Display YELLOW
    ?>
    <td valign="middle" style="background-color:#0FF;"><?php echo "Expire"?><sup><span class="preppy4"><?php echo $f5e?></span></sup></td>
    <?php    
    }else {
    ?>
    <td valign="middle" style="background-color:#F00;"><?php echo $f5?></td>
    <?php
    }
    ?>
    <td><?php echo $f6?></td>
    <td><?php echo $f1?></td>
    <td><?php echo $f99?></td>
    <td><?php echo $f12?></td>

    <td><?php echo $f3?></td>
    <td><?php echo $f216?></td>
    <td><?php echo $f6?> <?php echo $f15?></td>
    <td><?php echo $f10?></td>


    </tr>

    <?php
    $i
    ++;
    }
    ?>
    <tr style="font-weight:bold;" bgcolor="#817679">
    <td colspan="35"></td>
    </tr>


                <tr>
                    <td colspan="16" align="center">
                    <input name="delete" type="submit"  value="Submit">
                    </td>
                </tr>

    </table>
    </form> 
    </br>
    </body>

    </html>
    Please help me to create checkboxqty.php to get the selected rows total quantity from DB.

  5. #5
    SitePoint Enthusiast
    Join Date
    Mar 2011
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can anyone help me plz?

  6. #6
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    here is my code..some field remove to make it small.
    Its good you did that, but all that code you posted still does not encapsulate the problem you are trying to solve - and your question is too ambiguous for me.

    You have to do what we all end up doing.

    You make a mini database table that only contains the bare minimum of data.

    You make a mini script to query it.

    You dont bother with logins, or alternative colored backgrounds in html.

    Your html should not be aligned, or in tables, or have any JS at this stage.

    You pare it down to the minimum, sql, PHP and html.

    Then you experiment until either you sort the problem out, or you can post that minimum code on here along with here a) what you have and b) what you want to end up with.

    I appreciate that you have already reduced it, but posting PHP/SQL code hidden away in reams of html just turns everyone off, and nobody will bother answering your question (even when you send them PMs ) it gives the impression you have put little or no effort into this yourself.

    I am trying not to sound negative, but to honestly help you devise a winning strategy for tapping into the goodwill in the community to help you in your future programming life.

    Reading the classic how to ask questions the smart way should give you a good heads up, because by going through the process of checking if you are asking a "smart question" often leads to you finding the solution.

  7. #7
    SitePoint Enthusiast
    Join Date
    Mar 2011
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your suggestion, it would be helpful, if you would try to show the solution of my problem.

    I am getting data from my order table in a html form, with its id under checkbox, now i want to select some id by checkbox & want to get the total quantity from the mysql table in a new html form/page. I hope, i am able to make u understand my problem now.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •