Adding Additional Parameters to a link based on form Input
I am trying to add whatever is given as input for the input tags with id "tid" and "split_fraction" as additional paramaters on my link. How would I do this?
开发者_开发问答<span>Id:</span><input id="tid" size = "6">
<span>Split fraction</span><input id="split_fraction" size = "6">
<a href=/test?Rule_Type=tid&mid=3&cid=4" >Add</a>
Actually, you need to reformat your form.
<form method="GET" action="/test">
<input type="hidden" name="mid" value="3">
<input type="hidden" name="cid" value="4">
<label for="tid">Id:</label><input id="tid" name="tid" maxlength="6">
<label for="split_fraction">Split Fraction:</label><input id="split_fraction" name="split_fraction" maxlength="6">
<button type="submit">Add</button>
</form>
What I changed
- I changed your
<span>
s to<label>
s which better describe the labels for your inputs, also using GET - I've changed the parameters already existing in the URL to hidden inputs.
- I've added names to the inputs so that they will occur in the URL parsing.
- I've changed the submit link to a submit
<button>
which better describes what you want to do. You may also use<input type="submit">
精彩评论