Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

button image as form input submit button?

Tags:

html

forms

<form method="post" action="confirm_login_credentials.php">     <table>         <tr>             <td>User ID:</td>             <td><input type="text" id="uid"></td>         </tr>         <tr>             <td>Password:</td>             <td><input type="text" id="pass"></td>         </tr>         <tr>             <td colspan="2" align="right">                 <a href="#"><img src="images/login.jpg"></a>             </td>         </tr>     </table> </form> 

I am using an image in place of a submit button. How can I submit the login details when the user clicks on the login image as a submit button does?

like image 715
nectar Avatar asked Aug 01 '10 10:08

nectar


People also ask

Can you use an image as a submit button?

Definition and UsageThe <input type="image"> defines an image as a submit button. The path to the image is specified in the src attribute.

What is a form image button?

PDF Studio is capable of creating an image import button to allow users to insert images into the PDF document when completing a form. This button is the same as a standard button only that it has specific settings and JavaScript set automatically to make it work as an image import button.


2 Answers

You could use an image submit button:

<input type="image" src="images/login.jpg" alt="Submit Form" /> 
like image 165
Darin Dimitrov Avatar answered Sep 19 '22 16:09

Darin Dimitrov


Late to the conversation...

But, why not use css? That way you can keep the button as a submit type.

html:

<input type="submit" value="go" /> 

css:

button, input[type="submit"] {     background:url(/images/submit.png) no-repeat;" } 

Works like a charm.

EDIT: If you want to remove the default button styles, you can use the following css:

button, input[type="submit"]{     color: inherit;     border: none;     padding: 0;     font: inherit;     cursor: pointer;     outline: inherit; } 

from this SO question

like image 40
Jahmic Avatar answered Sep 20 '22 16:09

Jahmic