Jump to content

severndigital

Members
  • Posts

    355
  • Joined

  • Last visited

Posts posted by severndigital

  1. I am trying to update quantities for items in a shopping cart that are being added to the form via a while loop. see below. I know I can be simplifying my Db queries, but that is not the focus of my question.

     

     

    <?
    //this is essentially what is happening.
    
    //first start the table and form
    echo '
    <form name="scartform" method="post" action="' . $_SERVER['PHP_SELF'] . '">
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="scartborder">
      <tr>
        <td class="scart_headers">Item</td>
        <td class="scart_headers">Desc.</td>
        <td class="scart_headers">Qty</td>
        <td class="scart_headers">Per Piece </td>
        <td class="scart_headers">Total</td>
      </tr>
      <tr>
        <td class="scartborder"><img src="images/spacer.gif" alt="spacer" width="10" height="10"></td>
        <td class="scartborder"><img src="images/spacer.gif" alt="spacer" width="10" height="10"></td>
        <td class="scartborder"><img src="images/spacer.gif" alt="spacer" width="10" height="10"></td>
        <td class="scartborder"><img src="images/spacer.gif" alt="spacer" width="10" height="10"></td>
        <td class="scartborder"><img src="images/spacer.gif" alt="spacer" width="10" height="10"></td>
      </tr>';
    
    //now loop the products into the table
    
    $sql = "SELECT * FROM fnlproducts WHERE dealerid='$dealerid'";
    
    $getcontents = mysql_query($sql);
    
    while($row = mysql_fetch_array($getcontents)){
            $scid = $row['scid'];
            $pid = $row['pid'];
    $qty = $row['qty'];
    	//get some information about the product.
    		$getpinfo = mysql_query("SELECT p_name,p_distrip,p_matrix,p_altprice FROM products WHERE pid='$pid'");
    		$prow = mysql_fetch_array($getpinfo);
    			$item = $prow['p_name'];
    			$distrip = $prow['p_distrip'];
    		$price = $prow['p_altprice'];
    
    		$tprice = $qty * $price;
    		$tprice = money_format('%i',$tprice);
    
    		$total_price = $tprice + $total_price;
    
    echo '<tr>
        <td class="scartborder"><span class="scitem">' . $item . '</span></td>
        <td class="scartborder"><span class="scitem">' . $distrip . '</td>
        <td class="scartborder"><span class="scitem">
    <!-- ####This is the quantity form field. -->
    <input name="quantity-' . $scid .'" type="text" id="thisisid" size="5" maxlength="3" value="' . $qty . '"></td>
    <! -- ####End quantity form field -->
    <td class="scartborder"><span class="scitem">' . $price . '</td>
        <td class="scartborder"><span class="scitem">' . $tprice . '</td>
      </tr>';
    }// end while loop.
    
    

     

    My question is when i submit the new quantites, how to post them? I can't seem to figure this out, because I have no way of knowing what the name of the field will be since I won't know beforehand what the $scid of the item will be.

     

    I know the post would be something like this

     

    $newquantity = $_POST['nameofqtyfield'];

     

    but again, i don't know how to post a field I won't know the name of ahead of time.

     

    Any help would be really great. even it means re-doing the query from the ground up.

     

    thanks in advance.

    Chris

  2. FPDF is a free library that allows you to generate PDFs on the fly. Then, you can just attach it to an email and you're set.

    I agree,

     

    i have had much success with Fpdf. The only place it starts to break down function wise is when you are trying to create the Fpdf template information dynamically.

     

    otherwise it would be perfect for what you want to do with it.

     

     

     

  3. can you be more specific?

    what files are your trying to edit when you get the error?

    what is the location of the images you are trying to change?

    are the images being called dynamically? i.e. $imgname = somthing.gif;

     

    or are they static links? i.e. img src="something.gif"

     

    can you provide code examples?

     

    chris

  4. the error you are getting is because the user doesn't exits on the *nix machine.

     

    my simple work around would be to chmod the file so that no one can delete it.

     

    then when the user wishes to delete it, chmod it back to 777 and allow deletion.

     

    chris

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.