Redirect URL on login

I have embedded a login form using HTML form action on two of the pages on my site and would like users to be redirected back to the page they logged in from, but instead it goes back to the main page (the "fixed URL" I specified in the admin centre).

amember_redirect_url does not work, and when I leave the fixed URL blank it goes to the member page.