Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hi there! I encountered a problem within the view_cart.php script that has to do with the only input field  - Quantity. When there's already something in the cart, the quantity can't be changed manually and after I press the Update My Cart button nothing changes and the already preset qty is again displayed.

 

Here is the part of the script that in my opinion is problematic:

61 // Print the returned records
62		echo "\t<tr>
63				<td align=\"left\">{$row['artist']}</td>
64				<td align=\"left\">{$row['print_name']}</td>
65				<td align=\"right\">\${$_SESSION['cart'][$row['print_id']]['price']}</td>
66				<td align=\"center\"><input type=\"text\" size=\"3\" name=\"qty[{$row['print_id']}]\" value=\"{$_SESSION['cart'][$row['print_id']]['quantity']}\" /></td>
67				<td align\"right\">$" . number_format($subtotal, 2) . "</td>
68			</tr>\n"; 

My guess is that because the value argument is preset with the quantity coming from the session (line 66 of the script), nothing else can be entered into the qty field.

 

Has anybody encountered the same issue? What would the work around be?

 

Thank you for taking the time!

 

Link to post
Share on other sites

Hmmm...the code was working as I tested it when I wrote the book. I imagine the problem is somewhere else. The value there comes from $_SESSION['cart'][$row['print_id']]['quantity'], so I'd check if that value isn't being changed earlier in the script as it should be.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...