Html submit value based on which button is clicked -
is possible submit hidden name value pair based on button clicked?
here's form:
<form action="post" action=""> <button> <input type="hidden" name="vote" value="up"/> vote up! </button> <button> <input type="hidden" name="vote" value="down"/> vote down </button> </form>
for reason, name value pair received latter (the first 1 got replaced). example user clicked on 'vote down', still $input['vote']
= up
does know how fix this?
this because put both of them in form parameters received server like
vote=up&vote=down
assume access using php associative array received latest value in entries having same key. aside, why not just
<form action="post" action=""> <button> <input type="hidden" name="vote" value="up"/> vote up! </button> </form> <form action="post" action=""> <button> <input type="hidden" name="vote" value="down"/> vote down </button> </form>
Comments
Post a Comment