Skip navigation
Currently Being Moderated

Shouldn't this line of code work?

Jul 15, 2012 5:43 PM

Hi All...


I'm just trying to spruce up a HTML/PHP Form and change the look of the buttons...  I'm almost certain you can add a different button using tge "src" element in the following line of the form code...


<input name="submit" type="submit" src="images/subbtn.gif" value="submit">


But all I get are the standard buttons.                        

  • Currently Being Moderated
    Jul 15, 2012 6:16 PM   in reply to Prodigy9
    <input type="image" src="images/subbtn.gif" value="" onclick="this.form.submit();">


    Mark as:
  • Currently Being Moderated
    Jul 15, 2012 7:02 PM   in reply to Prodigy9

    Well, I've learnt somthing new. Input type image will only submit the form even without specifying an onclick event procedure.


    I don't know what your images look like, but if they look like buttons, you could use the image with the onclick events.



    Mark as:
  • Currently Being Moderated
    Jul 16, 2012 2:14 PM   in reply to Prodigy9

    There are inherent problems with HTML image buttons -- especially with PHP forms.


    Safest methods: 

    • use plain form submit buttons, 
    • CSS styled submit buttons,
    • put your images in the CSS background as shown below.


    /**normal state**/

    form input[type=submit] {

    background : url("submit.png") no-repeat center center;

    width : 115px;

    height :52px;

    border : none;

    color : transparent;

    font-size : 0 /**for older IE**/



    /**on mouse over**/

    form input[type=submit]:hover {

    background : url("submit-hover.png") no-repeat center center;





    Nancy O.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points