in reply to Pass variable values from HTML to CGI using "onclick"
...there are probably more robust ways of achieving what you want, though. Modifying a bit poj's form sample, we can do this:function setval(varval) { mysample= varval; var inputs = document.getElementsByName("mysample"); inputs[0].value = mysample; alert(mysample); }
<form action="test.cgi" method="post"> <input type="submit" name="action-add" value="Add"/> <input type="submit" name="action-edit" value="Edit"/> <input type="submit" name="action-delete" value="Delete"/> <input type="hidden" name="hide" value="123"/> </form> ... if ($cgi->param('action-add')) { # do something ... } elsif ($cgi->param('action-edit')) { ... etc
|
|---|