Jump to content


Writing a cookie on the click of an item for inventory

  • Please log in to reply
1 reply to this topic

#1 fpad77

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 06 June 2006 - 11:14 AM

Hey there, was wondering if someone could give me a hand with something, its most likely a relatively simple solution but was hoping someone could guide me the right way with it.

What I am doing is having an inventory that runs down the left of my site (portfolio site), and what I am doing is using items that you can find in the site that unlock extra things.

So if the user finds an item they click on it then it is added to their inventory.
What I have got so far in this is just use phpinclude to run a code before an image in the inventory can be displayed which goes as follows (missing out the top part, just to show its main use)

        echo "<a href=\"$href\"><img src=\"$image_folder/$image_name\" alt=\"You've got the key!\" /></a>";
        echo "<a href=\"$href2\"><img src=\"$image_folder/$no_image_name\" alt=\"You need to find the item first!\" /></a>";

Theres probably better ways of doing this (if you got something better let me know, haha!), but this was my solution. My next problem is how would I correctly attatch something to a clickable image (ie- of a key, a chest etc) that when it is clicked it would write the cookie 'gotkey1', it would only need to be set for say an hour. I know how to write the cookie I just dont know how to get it to work with the click of the image.

Because I'm aware that the inventory item would only be shown once the next page is loaded (without using refresh), when you click the item you'd go to a new page that says 'you've found the key etc etc etc'

Any ideas?

#2 fpad77

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 06 June 2006 - 12:05 PM

Anybody? lol

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users