type=image not working as I expected in IE

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • banning
    New Member
    • Aug 2007
    • 42

    type=image not working as I expected in IE

    Ok this makes no sense to me seeing as how PHP should work regardless of the browser... or am i wrong on that? ANYWAY here...

    [HTML]<form action="<? $_SERVER['PHP_SELF'] ?>" method="post" enctype="multip art/form-data">
    <input type="image" name="submit1" value="submit1" src="imgs/uploadimg.jpg" width="169" height="35" />[/HTML]

    there is the HTML code for the form now the php

    [PHP]if(isset($_POST['submit1'])){
    do php stuff
    }[/PHP]

    and thats the php... i dont know im flipping lost cause it works fine in FireFox (of course) what i am assuming is that im usying input type="image" instead of input type="submit" and IE wants to hate me for it... LOL yea as always any and all input would be had thanks in advance for your help :)
  • banning
    New Member
    • Aug 2007
    • 42

    #2
    ok so i tried it real quick wit input type="submit" and it worked.. (idk why i didn't try that before i posted) HOWEVER!!! lol i still would like to know why input type="image" worked in firefox but not IE... cause yeah id really like to have a custom button.. and i really dont wanna write a bunch of javascript just to get it...

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      Here's something interesting for you:
      Originally posted by jollymcfats
      With image submits, you'll get 2 name/value pairs when the button is clicked. For 'restore', the browser will send 'restore.x' and 'restore.y', and the values are the x/y coordinates of where they clicked on the image.

      Try
      [php]
      if (isset($_POST['restore'] ¦¦ isset($_POST['restore_x']))
      {
      code..
      }
      [/php]
      ..and you'll be fine.

      note that PHP will turn the '.x' suffix into a '_x'...
      There's more interesting work arounds on the board i got that ^ snippet from http://www.webmasterworld.com/forum88/4894.htm

      Comment

      • banning
        New Member
        • Aug 2007
        • 42

        #4
        here is what i ended up doing

        [HTML]<input type="hidden" name="submit" value="submit">
        <input type="image" src="url" />[/HTML]

        Comment

        • TheServant
          Recognized Expert Top Contributor
          • Feb 2008
          • 1168

          #5
          Originally posted by banning
          here is what i ended up doing

          [HTML]<input type="hidden" name="submit" value="submit">
          <input type="image" src="url" />[/HTML]
          So you put that in a table cell or tags or what? Just curious because I wanted to do a similar thing ages ago but couldn't get it to work.

          Comment

          • banning
            New Member
            • Aug 2007
            • 42

            #6
            Originally posted by TheServant
            So you put that in a table cell or tags or what? Just curious because I wanted to do a similar thing ages ago but couldn't get it to work.
            I am afraid i don't understand your question... sorry i'm not on here often i don't usually expect people to have questions for me haha.... but if you're still around and you get this id love to answer your question, just not quit sure what exactly your asking.

            Comment

            • Markus
              Recognized Expert Expert
              • Jun 2007
              • 6092

              #7
              Originally posted by TheServant
              So you put that in a table cell or tags or what? Just curious because I wanted to do a similar thing ages ago but couldn't get it to work.
              You just put it in a form :)

              Comment

              • TheServant
                Recognized Expert Top Contributor
                • Feb 2008
                • 1168

                #8
                Originally posted by markusn00b
                You just put it in a form :)
                lol, cheers guys, I will have a go later.

                Comment

                Working...