Jump to content

Add link ID into an Array


Dysan

Recommended Posts

Hello,

 

I have a page containing 5 links, each link has a different ID number at the end. (Shown in Bold)

 

http://localhost/Memory.php?action=add&id=1

http://localhost/Memory.php?action=add&id=2

http://localhost/Memory.php?action=add&id=3

http://localhost/Memory.php?action=add&id=4

http://localhost/Memory.php?action=add&id=5

 

Each time a link is clicked, how do I add the id at the end of each link, to an array? But, if array already contains that particular ID, how do I display a message notifying the user e.g. "Already Added!"

 

Once in the array, how do I output the items in the array to the screen, along with a remove button.

 

Upon clicking the remove button, how do I delete the appropriate id from the array. The remove link will be in the form of the following:

 

http://localhost/Memory.php?action=delete&id=1

http://localhost/Memory.php?action=delete&id=2

http://localhost/Memory.php?action=delete&id=3

http://localhost/Memory.php?action=delete&id=4

http://localhost/Memory.php?action=delete&id=5

Link to comment
https://forums.phpfreaks.com/topic/78127-add-link-id-into-an-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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