Monday, 15 September 2014

html - Different action url for a button within one form -



html - Different action url for a button within one form -

there buttons within form. want 1 of them utilize url action url. want within form, don't want , can't create form that.

how can that?

you can utilize javascript this

<form name="my_form" method="post"> name <input type="text" name="person_name" /><br /> <input type="button" value="button 1" name="button_1" onclick="return target_btn1();"> <input type="button" value="button 2" name="button_2" onclick="return target_btn2();"> </form> <script> function target_btn1() { document.my_form.action = "whatever.php"; //trigger action document.my_form.submit(); //submit action performed homecoming true; } function target_btn2() { document.my_form.action = "whatever2.php"; //trigger action document.my_form.submit(); //submit action performed homecoming true; } </script>

html

No comments:

Post a Comment