-1

I've been writing an HTML/PHP code that sends data using a Form. I found that I can use <button> with ajax to send the data, or use <input type= submit> to do the same task.

I want to know which is better or preferable to use and why?

j08691
  • 204,283
  • 31
  • 260
  • 272
  • They do the same thing. Take your pick. And this question is an exact duplicate of https://stackoverflow.com/questions/469059/button-vs-input-type-button-which-to-use?rq=1 – j08691 Feb 21 '22 at 17:32

1 Answers1

0

Function of both tag is same in the form with type attribute.

<input type="submit" value="Post" />
<button type="submit">Post</button>
Suraj Paudel
  • 13
  • 1
  • 6