submit - Multiple Form Actions to different pages / different target windows -
i have form on page needs have multiple form actions associated it. i'm using following script in conjunction following code achieve this:
<script> function submitform(action) { document.getelementbyid('summary').action = action; document.getelementbyid('summary').submit(); } </script> <form action="go-gold.php" method="post" enctype="multipart/form-data"> <input type="image" id="arrow" name="go_back" onclick="submitform('go-gold.php')" value="go_back" src="images/arrow_back.png" class="submit_button" /><br> <input type="image" id="arrow" name="submit_form" onclick="submitform('registration.php')" value="submit_form" src="images/arrow.png" class="submit_button" /> </form>
the first button needs "go back" within same browser window (self), , second button needs submit info new window (blank). how modify code achieve this? putting "target" functions within input type doesn't work, , putting target in form tag makes both submit buttons submit same window.
thanks!
easy jquery, have identical ids 2 separate form elements. should have these distinct ids unless want use class name. php can submit forms same page using $_server superglobal using $_server['php_self'] forms action name.
<script> $(document).ready(function() { $(".submit_button").click(function() { clickval = $(".submit_button").val(); if(clickval == 'go_back') { //do go stuff } if(clickval == 'submit_form') { // actions other page } }); }); </script> <form action="go-gold.php" method="post" enctype="multipart/form-data"> <input type="image" value="go_back" src="images/arrow_back.png" class="submit_button" /><br> <input type="image" value="submit_form" src="images/arrow.png" class="submit_button" /> </form>
Comments
Post a Comment