Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,234
    Thanks
    51
    Thanked 100 Times in 99 Posts

    Changing submit button to image

    So I have a submit button which uses a POST method. However when I change it to an image one, it messes everything up because "type" needs to be submit, so when it's image it doesn't work, it says "Submit Query".

    Any ideas on a way around this? Might have to set it up as a css div.

    OLD
    Code:
    <input type="submit" name="fight" value="Attack" />
    NEW
    Code:
    <input src="images/fightaction/attack_button.gif" name="fight" type="image">
    Been a sign maker for 7 years. My business:
    American Made Signs

  • #2
    Regular Coder dan-dan's Avatar
    Join Date
    Aug 2009
    Location
    England
    Posts
    483
    Thanks
    22
    Thanked 79 Times in 78 Posts
    As far as I can remember, using images as buttons the name must be submit name="submit"

  • #3
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    You could set the image as a background of the input:

    Code:
    .submit {
        background: url('image.png') no-repeat center center;
    }
    Code:
    <input type="submit" value="" class="submit" />
    or you could use the <button> tag:

    Code:
    <button>
       <span>Submit</span>
       <img src="image.png" />
    </button>
    The button tag is tricky, I wouldn't recommend using it if you can just use <input>

    Out of curiosity, why are you using type="image"? It has a specific use.
    Last edited by Sammy12; 03-11-2012 at 08:03 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •