Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2007
    Location
    malaysia
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    shopping cart table

    hye guys, i really2 need your help. I'm doing a shopping cart.
    But the thing is..I dont want the select product row appears after
    i've choosen 1 product item unless i click on the Add product button.
    How can i do that? Thank you for your time and hope this thread can help other ppl who is doing shopping cart in the future



    PHP Code:
     <table border="1" width="70%">
                                <tr bgcolor="#CCCCCC">
                                    <td width="" align="center"><input type="checkbox" name="allbox" onClick="checkAll()"></td>
                                    <td width="" align="center">NO.</td>
                                    <td width="" align="center">PRODUCT</td>
                                    <td width="" align="center">UNIT PRICE</td>
                                    <td width="" align="center">QUANTITY</td>
                                    <td width="" align="center">TOTAL</td>
                                </tr>
                                  <?
                                    
    for($counter=1$counter <= $itemCount$counter++)
                                    {
                                  
    ?>
                                  <tr>
                                    <td width="" align="center"><input type="checkbox" name="checkProduct[]" value="<? echo $counter?>" onclick="uncheckAll(this)"></td>
                                    <td width="" align="center"><? echo $counter?></td>
                                 
                                 
                                  
                    
                                  
                                  <? 
                                  
                                                  $aPro 
    db_query("SELECT * FROM product_ms");
                                                  if (!
    is_array($aPro))
                                                  {
                                                    echo 
    "no product available";
                                                  }
                                                  else if (
    $counter $itemCount)
                                                  {
                                                    foreach (
    $aPro as $row2)
                                                    {
                                                     if (
    $arr[$counter][1] == $row2["product_code"])
                                                     {
                                                        
    $totalProduct_out$arr[$counter][2] * $row2["product_price"];
                                                        
    $totalProduct_out number_format($totalProduct_out2);
                                  
    ?>
                                    <td width="" align="center"><input type="hidden" name="<? echo "p".$counter?>" value="<? echo $row2["product_code"?>"><?echo $row2["product_desc"]?></td>
                                    <td width="" align="right">RM <input type="hidden" size="5" name="<? echo "priceOutput".$counter?>" type="text" value="<? echo $row2["product_price"?>"><?echo $row2["product_price"]?></td>
                                    <td width="" align="center"><input type="hidden" name="<? echo "q".$counter?>" type="text" value="<? echo $arr[$counter][2]; ?>"><?echo $arr[$counter][2];?></td>
                                    <td width="" align="right">RM <input name="<? echo "totalProduct_out".$counter?>" type="hidden" value="<? echo $totalProduct_out ?>"><? echo $totalProduct_out ?></td> </tr>
                                  <?
                                                      
    }
                                                    }
                                                   }
                                                   else
                                                   {
                                     
    ?>
                                    <td width="" align="center">
                                        <select class="standardselect" name="<? echo "p".$counter?>" onchange="showPrice(this.value,<? echo "q".$counter?>.value)">
                                                <option value="">--Select product--</option>
                                                <?
                                                  $aProduct 
    db_query(" SELECT * FROM product_ms WHERE product_display = 'Y' order by product_code ");

                                                  if (!
    is_array($aProduct) )
                                                  {
                                                   echo 
    "<option value=''>no Product available</option>";
                                                  }
                                                  else
                                                  {
                                                      foreach (
    $aProduct as $rowProduct)
                                                      {
                                                        echo 
    "<OPTION VALUE=".($rowProduct["product_code"]).">".($rowProduct["product_desc"])."</OPTION>";
                                                      }
                                                  }
                                                
    ?>
                                        </select>
                                   </td>
                                   <td width="" align="center">RM <input size="5" name="priceOutput" type="text" value=""  readonly="true">
                                   </td>
                                 </td>
                                <td width="" align="center">
                                    <select class="standardselect" name="<? echo "q".$counter?>" onchange="totalProduct(this.value, priceOutput.value)">
                                    <?
                                      
    for($i=1;$i<=10;$i++)
                                      {
                                       echo 
    "<option value=".$i.">".$i."</option>" ;
                                      }
                                    
    ?>
                                    </select>
                                </td>
                                <td width="" align="center">RM <input size="5" name="totalProduct_out" type="text" value="" readonly="true"></td>
                                    <?
                                                  
    }
                                           }
                                    
    ?>
                                    </tr>
                           </table>
                           </td>
                       </tr>
                       <tr valign="top">
                           <td colspan="2"></td>
                           <td align="left"><br>
                               <input type="submit" name="btnAdd" value="Add Product" style="font-size: 12px; width: 80px;" />&nbsp;&nbsp;&nbsp;
                               <input type="submit" name="btnDelete" value="Delete Product" style="font-size: 12px; width: 90px;" />
                           </td>
                       </tr>

  • #2
    New Coder
    Join Date
    Jul 2007
    Location
    malaysia
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    anyone?

  • #3
    New Coder
    Join Date
    Jul 2007
    Location
    malaysia
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hmmmm?

  • #4
    Regular Coder meth's Avatar
    Join Date
    Jan 2003
    Posts
    262
    Thanks
    0
    Thanked 9 Times in 9 Posts
    Sorry, but is english your 2nd language? If I have to read a post more than twice to gather it's meaning, I give up and move on. Not enough spare time to try and interpret obscure meanings.
    I do Web Design, Brisbane based.
    More time spent in PHP/MySQL Web Development.
    And Search Engine Optimisation takes up the rest of it.


  •  

    Posting Permissions

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