u need to friggin test ur script
when you try to add an item, it asks for item, data, then asks for item and data again
also, you should disable the - in the items until you click an item
when you remove stuff, i think that this would come in handy:
echo $$?!=\"Are you sure you would like to remove $did(name,id).seltext $+ ?)\"
if ($! == $true) {
do remove stuff...
}