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.



<title>View orders details</title>



<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>Style No</td>
<td>Days To Go</td>

<td>Buying House</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>
$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";




while ($i < $num) {
$f3=date("j-M-y", $fdate);

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






$f400g= date("Y-m-d");



$f5e = substr("$result13", 0, 4);

$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>
if($f5>60) {
    // Display RED
<td valign="middle" style="background-color:#0F0;"><?php echo $f5; ?></td>
} elseif($f5>30 && $f5<61) {
    // Display YELLOW
<td valign="middle" style="background-color:#FF0;"><?php echo $f5; ?></td>
} 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>
}else {
<td valign="middle" style="background-color:#F00;"><?php echo $f5; ?></td>
<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 style="font-weight:bold;" bgcolor="#817679">
<td colspan="35"></td>

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



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


I'm writing because I have noticed that your question haven't had a single answer in 2 weeks. That is very unusual, and I've looked at your questions and your code sample to see if I could help you. Well, I can't. Not now anyway. But at least I may give you some hints to help you get some answers to your questions:

Because I'm sure we're many out here that wants to help you. But it is very hard to help given the information you provide us with. I'll try to give you some hints to make it easier.

First of all: Your code is really hard to read when you mix php and html the way you do. Keeping logic and presentation separate is a key issue in good programming practise. Try putting your php-code away in one place and use your own functions to perform the different tasks. Then you can write html-code and only insert the variables at the relevant places. It can't be done 100% (eg when you loop over the query result), but you can go a long way.

Second: When using variable names try to use names that describes the content of the variable. $f216 and $f10 does not makes much sense to the casual reader, while $today and $orderQty does. It's a great help if you ask others to read your code.

Third: Give us what we need to identify the problem. Most of your code is about the presentation of your table (colors, size etc). While important to the enduser it only makes it difficult to pinpoint problems in this forum.

Theres is no way that the reader can recreate your webpage anyway. First because we don't know the how the basic tables you're querying looks like or what they contain. Second because you are referencing both css-files and som javascript that we don't have access to. Third, you're including another php-file. And I can see, that some variables are only referenced and not defined in the code you have quoted.

I will suggest that you write a short sample of code, that demonstrates exactly where the problem lies and what you want your code to do.

Be very clear about what information you want to get from the database in your query and what you want your php-code to do. You should also describe the whole functionality: You have a form that calls itself and it contains a link to another program that takes the values of the calling instances (not the current data) as parameters. This may not be what you really want, but we don't know.

I know the above does not solve your problem, but it may make it easier to get help!

Steen Andersen

commented: Excellent advices to any poster indeed +4
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.