shopping cart delete item

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

terrenuit
Forum Commoner
Posts: 53
Joined: Tue Jul 08, 2014 2:18 pm

Re: shopping cart delete item

Post by terrenuit »

no, it doesn't work
<a href="cancel.php?ref=<?= $product['ref']; ?>"><img src="photos/garbage.jpg"></a>

and that neither
<td align="center" > <img src="photos/garbage.jpg" width="23" height="40" border="0" usemap="#Map"> <map name="Map">
<area shape="rect" coords="2,0,34,47" href="cancel.php?ref=<?php print $product['ref'] ?>"></map>
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: shopping cart delete item

Post by Celauran »

You previously stated that this works:

Code: Select all

<a href="cancel.php?ref=<?php print $product['ref'] ?>">cancel</a>
But this doesn't?

Code: Select all

<a href="cancel.php?ref=<?= $product['ref']; ?>"><img src="photos/garbage.jpg"></a>
That doesn't make any sense. It's the exact same code.
terrenuit
Forum Commoner
Posts: 53
Joined: Tue Jul 08, 2014 2:18 pm

Re: shopping cart delete item

Post by terrenuit »

yes, it works correctly
<a href="cancel.php?ref=<?php print $product['ref'] ?>">cancel</a>

but not this
<a href="cancel.php?ref=<?= $product['ref']; ?>"><img src="photos/garbage.jpg"></a>
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: shopping cart delete item

Post by Celauran »

That really doesn't make sense. It's literally the same code. Is it generating any errors? What's happening?
terrenuit
Forum Commoner
Posts: 53
Joined: Tue Jul 08, 2014 2:18 pm

Re: shopping cart delete item

Post by terrenuit »

I have used another way, but it doesn't work too, do you have any idea in this way ?

<td><form action="cancel.php?ref" method="post">
<input type="hidden" name="ref" value="<?php print $product['ref'] ?>">
<input type="image" name="submit" value="photos/garbage.jpg"/>
</form>
</td>
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: shopping cart delete item

Post by Celauran »

If you're going to use a POST request, then the form action should be cancel.php and you'll need to change the code in cancel.php to look for $_POST['ref'] rather than $_GET['ref']
terrenuit
Forum Commoner
Posts: 53
Joined: Tue Jul 08, 2014 2:18 pm

Re: shopping cart delete item

Post by terrenuit »

I understand the problem, for this script:
<img src="photos/garbage.jpg" width="23" height="40" border="0" usemap="#Map"> <map name="Map">
<area shape="rect" coords="2,0,34,47" href="cancel.php?ref=<?php print $product['ref'] ?>"></map>
if there is serveral items, every time cancel.php?ref=first item, which means <?php print $product['ref'] ?> always in the first item position.

but I d'ont understand why this script can cancel correctly each item, do you have any idea ?
<a href="cancel.php?ref=<?php print $product['ref'] ?>">cancel</a>
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: shopping cart delete item

Post by Celauran »

I have asked you if that code is being generated inside a loop, have asked to see the surrounding code, and I haven't received an answer to either. I don't know. I also don't know why you insist on using image maps.
terrenuit
Forum Commoner
Posts: 53
Joined: Tue Jul 08, 2014 2:18 pm

Re: shopping cart delete item

Post by terrenuit »

I have solved the problem, the script:

<a href="cancel.php?ref=<?php print $product['ref'] ?>"> <img src="photos/garbage.jpg" width="23" height="40"></a>
thank you so much
Post Reply