What doesn't work? You need to find which part doesn't work specifically. Is the function being called? What part of the code does and does not execute?
Also, your elseif will never be executed. You should combine the two and only change the part where the two codes differ.