Home > Net >  HTML form action relative path wrong
HTML form action relative path wrong

Time:09-22

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

CodePudding user response:

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