Jump to content

how can a css button be used to send php post data if at all


ajoo
Go to solution Solved by requinix,

Recommended Posts

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'>&nbsp Left</a></div>

kL4xu.png


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.

Link to comment
Share on other sites

  • Solution

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.

Link to comment
Share on other sites

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 !

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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 by ajoo
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.