HTML form action relative path wrong

Viewed 13

I have a form with a relative path action action="updateItem/:id" in the route /wishlist/admin. I expected this to post to /wishlist/admin/updateItem/:id but it's posting to /wishlist/updateItem/:id instead.

Is there any way to make this relative to the current page or should I add admin/ to the start of the form action?

enter image description here

1 Answers

A relative path replaces everything after the last / in the existing path.

Your base URL needs to be /wishlist/admin/ and not /wishlist/admin.


I generally recommend using absolute paths to avoid any issues with having two similar URLs like that.

Related