fpad77 Posted June 6, 2006 Share Posted June 6, 2006 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)[code] if(isset($_COOKIE['gotkey1'])){ echo "<a href=\"$href\"><img src=\"$image_folder/$image_name\" alt=\"You've got the key!\" /></a>"; }else{ echo "<a href=\"$href2\"><img src=\"$image_folder/$no_image_name\" alt=\"You need to find the item first!\" /></a>"; }[/code]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?Cheers, Adam Quote Link to comment https://forums.phpfreaks.com/topic/11314-writing-a-cookie-on-the-click-of-an-item-for-inventory/ Share on other sites More sharing options...
fpad77 Posted June 6, 2006 Author Share Posted June 6, 2006 Anybody? lol Quote Link to comment https://forums.phpfreaks.com/topic/11314-writing-a-cookie-on-the-click-of-an-item-for-inventory/#findComment-42377 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.