Reputation: 37
is there a way that i can differentiate the value with the same name?
<input type="hidden" name="id" value="name1">
<input type="hidden" name="id" value="name2">
<input type="hidden" name="id" value="name3">
is there a way that when i post an id, the value that will be posted would be name2?
Upvotes: 0
Views: 62
Reputation: 9476
Use array for the name
<input type="hidden" name="id[]" value="name1">
<input type="hidden" name="id[]" value="name2">
<input type="hidden" name="id[]" value="name3">
which provides all the values in array.
hope this help.
Upvotes: 2
Reputation: 15919
No, you can not do that. You need to specify different names or to use somthing like an array. This can be done by setting the name id[].
What want you to do?
You can set the value of the hidden field dynamicaly with javascript, if that is what you are looking for.
Upvotes: 0
Reputation: 987
use different names for different variables.
<input type="hidden" name="id2" value="name2">
Upvotes: 0