Jump to content

Recommended Posts

I have a few links to buy gifts from a store and handle the clicks with jquery sop i can update the database without page refresh, when i set the links to diffrent id's and process them 1 by 1 it works ok but i want to save load and process all the hrefs in one like so.

 

$(document).ready(function (){

$("#gt").click(function(){

$.get("processgift.php", { 
gift: $('#gt').attr('gift') 

});

});

});

<a href="#" id="gt" gift="roses"><img src="gifts/roses.jpg" style="margin-left: 20px; height: 100px; width: 100px; border: 2px solid #EDEDEE;"></a>
<a href="#" id="gt" gift="chocs"><img src="gifts/chocs.jpg" style="margin-left: 20px; height: 100px; width: 100px; border: 2px solid #EDEDEE; "></a>
<a href="#" id="gt" gift="wine"><img src="gifts/wine.jpg" style="margin-left: 20px; height: 100px; width: 100px; border: 2px solid #EDEDEE;"></a>
<a href="#" id="gt" gift="meal"><img src="gifts/meal.jpg" style="margin-left: 20px; height: 100px; width: 100px; border: 2px solid #EDEDEE;"></a>
<a href="#" id="gt" gift="flowsers"><img src="gifts/flowers.jpg" style="margin-left: 20px; height: 100px; width: 100px; border: 2px solid #EDEDEE;"></a>
<a href="#" id="gt" gift="tea"><img src="gifts/tea.jpg" style="margin-left: 20px; height: 100px; width: 100px; border: 2px solid #EDEDEE;"></a>
<br /><br />
<a href="#" id="gt" gift="necklace"><img src="gifts/necklace.jpg" style="margin-left: 20px; height: 100px; width: 100px; border: 2px solid #EDEDEE; "></a>
<a href="#" id="gt" gift="loveheart"><img src="gifts/loveheart.jpg" style="margin-left: 20px; height: 100px; width: 100px; border: 2px solid #EDEDEE;"></a>
<a href="#" id="gt" gift="wink"><img src="gifts/wink.jpg" style="margin-left: 20px; height: 100px; width: 100px; border: 2px solid #EDEDEE;"></a>
<a href="#" id="gt" gift="popcorn"><img src="gifts/popcorn.jpg" style="margin-left: 20px; height: 100px; width: 100px; border: 2px solid #EDEDEE;"> </a>
<a href="#" id="gt" gift="ring"><img src="gifts/ring.jpg" style="margin-left: 20px; height: 100px; width: 100px; border: 2px solid #EDEDEE;"> </a>
<a href="#" id="gt" gift="kiss"><img src="gifts/kiss.jpg" style="margin-left: 20px; height: 100px; width: 100px; border: 2px solid #EDEDEE;"> </a>


 

But that way nothing updates, anyway i can do this?

 

processgift.php

 

$gift = $_GET['gift'];


$username = $_SESSION['username'];


include("connect.php");



mysql_query("UPDATE gifts SET $gift = $gift+1 WHERE username = '$username'");

Link to comment
https://forums.phpfreaks.com/topic/243423-help-with-href-processing/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • 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.