ajoo Posted May 15, 2016 Share Posted May 15, 2016 I have the following piece of code give me a beautiful button that I want to use in a form. <div class='lbk'><a href='' class='btn_lft'>  Left</a></div> On pressing the button I want to send some post data back to the page which is where I am totally stumped and can't figure how I can do it with this button. It would be very simple to send it using a basically a simple submit button. But then I won't get the arrow button that looks so neat. Please can someone help me figure this out if it is possible. I do not wish to use Ajax etc. Thanks all. Quote Link to comment Share on other sites More sharing options...
Solution requinix Posted May 15, 2016 Solution Share Posted May 15, 2016 Plain HTML does not support submitting forms using links. You have two options: a) Use a form button ( or ) and style it like the way you want. It is possible and not much more work to do since you have the appearance already working for a link. b) Put an onclick handler on the link and cause it to submit the form. This isn't AJAX but it does require Javascript. The first option is much better than the second. Quote Link to comment Share on other sites More sharing options...
ajoo Posted May 17, 2016 Author Share Posted May 17, 2016 Hi Requinix, Thanks for the reply and sorry for the delay. I have been struggling with this for quite sometime. I actually need to submit php values using the button, just like a regular button. I have been trying out this on a fiddle and here is the link to it : https://jsfiddle.net/ajoo/hm11o3oh/3/ The triangular part of the button breaks and the button loses its shape. Kindly have a look at the fiddle and guide. Thanks ! Quote Link to comment Share on other sites More sharing options...
requinix Posted May 17, 2016 Share Posted May 17, 2016 I actually need to submit php values using the button, just like a regular button.What do you mean by that? I have been trying out this on a fiddle and here is the link to it : https://jsfiddle.net/ajoo/hm11o3oh/3/ The triangular part of the button breaks and the button loses its shape. Kindly have a look at the fiddle and guide. I don't see anything triangular. Quote Link to comment Share on other sites More sharing options...
ajoo Posted May 17, 2016 Author Share Posted May 17, 2016 (edited) Hi Requinix, Thanks for that reply. Yes that's happening due to Input[type=submit]. The triangular bit of the arrow disappears. It is retained with button[type=submit] but the arrow is distorted. Please check the new update to the link : https://jsfiddle.net/ajoo/hm11o3oh/9/ . Is it not possible to use the Input[type=submit] without distorting the button? To see the initial button with <a = href='' .. > this link : https://jsfiddle.net/ajoo/hm11o3oh/1/ I actually need to submit php values using the button, just like a regular button. I mean I need this button to send post values to the page. Thanks. Edited May 17, 2016 by ajoo Quote Link to comment Share on other sites More sharing options...
ajoo Posted May 17, 2016 Author Share Posted May 17, 2016 Hi Requinix, Thanks for your inputs. I was able to manage it. Thanks ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.