Web Hosting Talk







View Full Version : Php problem - Any help would be great


Rmurp006
01-27-2008, 04:59 PM
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.

ThatScriptGuy
01-27-2008, 05:28 PM
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

Rmurp006
01-27-2008, 05:34 PM
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

ThatScriptGuy
01-27-2008, 05:37 PM
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.

Rmurp006
01-27-2008, 05:43 PM
Thank you very much. I really appreciate it.

Codebird
01-27-2008, 06:25 PM
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"... />

Codebird
01-27-2008, 06:26 PM
the same php variable excuse me

Codebird
01-27-2008, 06:28 PM
cause if you look at the grand total you see it is still ok

Rmurp006
01-27-2008, 06:30 PM
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"

Codebird
01-27-2008, 06:33 PM
yes $qty is 1 variable that u have put for the input type="text"

Codebird
01-27-2008, 06:35 PM
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

Rmurp006
01-28-2008, 03:43 AM
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?