47 users online (1 members and 46 guests)  


  Results 1 to 6 of 6

Related

  1. Replies: 0
  2. Replies: 3
  3. Replies: 1
  4. Replies: 9
  5. Form input type    Forum: HTML Forum
    Replies: 1
  1. #1
    Zamees's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2003
    Posts
    19

    input type= image vs. submit

    It appears when i set the input type to submit, the code works fine, but when i change it to image, just reloads the same page without submitting the info. how come?


    Code:
    <form method=post action="<%= Request.ServerVariables("SCRIPT_NAME") %>" name=login>
    
    <input TYPE="submit" Name="action" value="login" src=login.jpg TABINDEX=3></td>      *GOOD*
    
    <input TYPE="image" Name="action" value="login" src=login.jpg TABINDEX=3></td>     *NO GOOD*
                </form>

  2. #2
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel
    I see no reason why it does not work, do you have a page that I can look at?

    Dave

  3. #3
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    The problem is 'probably' in the code that the form is submitted to, not the code itself. Try making the 'name' if the image input the same as the 'name' of the submit button.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  4. #4
    TurtleMan's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2003
    Posts
    5

    Having the same problem

    Quote Originally Posted by QuietDean
    The problem is 'probably' in the code that the form is submitted to, not the code itself. Try making the 'name' if the image input the same as the 'name' of the submit button.
    <B>Works:</B>
    <INPUT type=submit name=add value=\"Add User\">

    <B>Does not work:</B>
    <INPUT TYPE=image name=add SRC=images/buttons/add.jpg ALT=add VALUE=add>

    The form is submitting to itself and I have PHP that reads through the submitted data:
    if ( $this->rdata['add'] )
    $this->add_user_form();


    Once again, the submit button works fine, the image button does submit the 'name' to the form. Help?

    Thanks!

  5. #5
    TurtleMan's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2003
    Posts
    5
    ok, I found out what was going on.

    When it's just the submit button named add... it submits to the form with the value "add"....

    When it's the image... it submits to the form with the value "add_x". There is also a value for "add_y" which these values correspond to the x and y position of the mouse where you click on the picture.

    cheers

  6. #6
    sbl's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2009
    Location
    Dhaka, Bangladesh
    Posts
    2

    Wink Re: input type= image vs. submit

    Dear Zamees, You can use inline css here just like that...

    Code:
    <form method=post action="<%= Request.ServerVariables("SCRIPT_NAME") %>" name=login>
    
    <input TYPE="submit" Name="action" value="login" src=login.jpg TABINDEX=3></td>      *GOOD*
    
    <input TYPE="submit" Name="action" value="login" style="background:url(login.jpg); width:30px; height:30px;" TABINDEX=3></td>     *ALSO GOOD*
                </form>
    Last edited by sbl; 10-06-2009 at 04:31 AM.



Tags for this Thread