vendredi 17 avril 2015

How to make sure form's relative URL works?

This is my webpage



http://ift.tt/1yzQLLc


To update the product, I should submit to this URL



http://ift.tt/1JbyWCF


In the product page, I have these forms to submit data



<form method="post" action="update">
<input type="submit" />
</form>

<form method="post" action="./update">
<input type="submit" />
</form>


Both forms do not work, because it will submit to



http://ift.tt/1OO8tii


They only work if URL is



http://ift.tt/1yBMZ4g


If I hard code the product id in action



<form method="post" action="1/update">
<input type="submit" />
</form>


Then http://ift.tt/1yBMZ4g will not work, because it will submit to http://ift.tt/1OO8tik


What value should the action be to make sure the form can submit to correct URL?


If it is possible, I don't want to render absolute path or product id in form action.


Aucun commentaire:

Enregistrer un commentaire