GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Web  >  Html
Go To First  |  Previous Question  |  Next Question 
 Html  |  Question 32 of 43    Print  
Is it possible in HTML to add more than one submit button having different actions in a single form?

  
Total Answers and Comments: 3 Last Update: September 17, 2009     Asked by: Ammu 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
October 24, 2007 03:18:08   #1  
psuresh1982 Member Since: September 2006   Contribution: 1027    

RE: Is it possible in HTML to add more than one submit...

Yes it is possible. For each submit button onclick call one javascript function. Get the form id and assign the action url inside the javascript function.

 
Is this answer useful? Yes | No
July 17, 2008 05:57:17   #2  
webyfelix Member Since: July 2008   Contribution: 2    

RE: Is it possible in HTML to add more than one submit button having different actions in a single form?
No we cant give two actions for a single form. only one action can be performed

but we can give this in alternate way by using javascript

 
Is this answer useful? Yes | No
August 19, 2009 22:26:33   #3  
mk_geek Member Since: August 2009   Contribution: 1    

RE: Is it possible in HTML to add more than one submit button having different actions in a single form?

Yes you can:

in javascript:
<input type "button" onclick "add();" name "sub" value "add" />
<input type "button" onclick "edit();" name "sub" value "edit" />

and use
document.getElementById("formname").action "something.php";
document.getElementById("formname").submit();

or with PHP:
<input type "submit" name "sub" value "add"> <input type "submit" name "sub" value "edit">

you will have $_POST['sub'] equals "add" or "edit"
you can then use if or switch as you see fit in your server script.


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape