Results 1 to 12 of 12
  1. #1

    Php problem - Any help would be great

    Hi everyone.. I was surfing today and found this. I am currently creating a photography website and its coming along great. I created an admin panel where the owner can go in and add photos/edit/delete and all that good stuff. Now I am trying to configure my own personal shopping cart for the customers. I found some codes online and put them together. Worked out great. Now I am modifying the codes so I can have several options for each photo. Ex: 2 4x6s and 1 5x7. However every time I change the quantity of a 4x6 photo, it changes the quantity of the 5x7 photo to the same number. Think anyone can help me out? It would be greatly appreciated.

    To see my problem live, go to http://www.wegotfoto.com/albums.php?view&id=5. Then click the buy button on any photo. This will take you to the shopping cart where you can enter different quantities. Enter in a different number on one of those and click Update. You will then see both numbers change to the same number you entered.


    The 2 pages of coding that interact with eachother are:

    http://www.wegotfoto.com/cart.phph
    http://www.wegotfoto.com/inc/functions.inc.phph

    Once again.. thank you to anyone that can help me out. I've been stuck here for awhile.

  2. #2
    Join Date
    Feb 2003
    Location
    AR
    Posts
    2,381
    The problem I see is that when you add a product to the cart, it displays two fields for that product. The problem is that the two fields have the same name (Ex: qty264)

    So when you update it, it updates the quantity for 264 to be what you put in either box.

    They need to have different names, maybe qty264_5x7 and qty264_4x6

    Kevin

  3. #3
    Hmm I show them with different names. One is qty264 and the other is qty2264. For the second box.. i have it as qty2$id while the first is just qty$id

  4. #4
    Join Date
    Feb 2003
    Location
    AR
    Posts
    2,381
    I apologize - You're right. I misread the HTML output there.

    I don't have time to look at the PHP right now, but if no one has helped you by later tonight, I'll try to take a look for you.

  5. #5
    Thank you very much. I really appreciate it.

  6. #6
    Join Date
    Dec 2007
    Location
    Lebanon
    Posts
    413
    maybe in the value of that field u have put the the php variable
    <input type="text" name="qty248" value="2" ..../>
    <input type="text" name="qty2248" value="2"... />

  7. #7
    Join Date
    Dec 2007
    Location
    Lebanon
    Posts
    413
    the same php variable excuse me

  8. #8
    Join Date
    Dec 2007
    Location
    Lebanon
    Posts
    413
    cause if you look at the grand total you see it is still ok

  9. #9
    Hmm if you look in the php coding though.. I have the value = to the $id as well. Its just when viewing source it shows a number. Otherwise it is name="qty'.$id.'" value="'.$qty.'" size="3"

  10. #10
    Join Date
    Dec 2007
    Location
    Lebanon
    Posts
    413
    yes $qty is 1 variable that u have put for the input type="text"

  11. #11
    Join Date
    Dec 2007
    Location
    Lebanon
    Posts
    413
    for both input texts hence it is causing a problem cause look as I told you before if it was other than that the grand total would have changed

  12. #12
    HMm yeah.. well thanks for trying to help out in the AIM chat window.. Anyone else think they could help me out with this code?

Posting Permissions

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