What is difference between html button? – PHP

  php

Q(Question):

can you tell me the difference between the code:

<input type="submit" value="click me">

and

<button type="submit">click me</button>

//somebody tell me the difference between them with example

A(Answer):

Why don’t you look at this link http://www.w3schools.com/tags/tag_button.asp

<button> allows you to add an image to the button. I think you have have to manually assign the form submit() method to the button in order for it to actually submit the form.

A(Answer):

Tips and Notes

Important: If you use the <button> element in an HTML form, different browsers may submit different values. Internet Explorer, prior version 9, will submit the text between the <button> and </button> tags, while other browsers will submit the content of the value attribute. Use the <input> element to create buttons in an HTML form.

A(Answer):

@Murat: usually, there is no need to process the submit buttonÂ’s value. And I would always prefer <button> over <input>.

A(Answer):

For example… My form is submitting with get method. And i need 2 or more send button. And i need that button’s names and values to render form… If i click any button address bar is be http://example.com/formrender.php?fi…nName=sendmail or http://example.com/formrender.php?fi…me=anothertask etc… filling.

I mean is : vary according to needs… And the decision is yours.

Edit: Sorry for my bad english. I tried to explain something. And i used google translate. My english is not good. I hope you understand…

A(Answer):

that would lead to the question, why would you need 2 different submit buttons? but that is a question worth of its own thread.

A(Answer):

Why… For example, i have a data table. And each row has got a checkbox for row’s id. And i have 2 buttons. Someone delete button, someone multi edit button.

Edit : But such a form is not sending get method. Because ids an array…

LEAVE A COMMENT