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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    New Coder
    Join Date
    Feb 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Form Input type =Image not passing in IE

    Does anyone know why IE does not pass image input variable values from a form in IE?
    Does anyone know a work around for this?

    Heres what I have:
    A form with images as input fields. I would like for the person to click on the image and that submits the form. I've got it working and passing the value of the variable in Safari, Firefox and Netscape but not IE. The variable gets passed to the database and the next page in all the mentioned browsers except IE. I need a work around asap.

    Any help would be greatly appreciated.
    I must use the imagas as the submit buttons to pass the variable into the database to.

  • #2
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Are you, by any chance, doing it like this?
    Code:
    <input name="imagesubmit" type="image" value="Whatever"  src="image.gif" />
    That should work in all browsers
    I'm not sure if this was any help, but I hope it didn't make you stupider.

    Experience is something you get just after you really need it.
    PHP Installation Guide Feedback welcome.

  • #3
    New Coder
    Join Date
    Feb 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, exactly like that. For whatever reason IE will not except the value of the variable from the Image Input Field. Again, It works with all other browsers. Currently I've had to set up a check box under the images and a validation script to check and make sure the boxes are checked but this is a ridiculous way of doing things, plus the checkboxes look ugly under the image input fields.

  • #4
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Odd... I use that day by day with my IE... with no problems...
    If the only thing that doesn't get sent is the value (value shouldn't be set by you as the value is the x,y position of the mouseclick) you can use a hidden field...
    Last edited by marek_mar; 02-07-2006 at 08:05 PM.
    I'm not sure if this was any help, but I hope it didn't make you stupider.

    Experience is something you get just after you really need it.
    PHP Installation Guide Feedback welcome.

  • #5
    New Coder
    Join Date
    Feb 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm trying to pass the input variable to php and send it into a mysql db. It is odd. But my jaw nearly hit the floor at 3am when 50 people had already used an online sweepstakes form I set up and none of the values from the input>type>image field were getting passed. I noticed some were and some were not. I ran tests in safari never even thinking IE would have this sort of issue. I ran tests in firefox and netscape and noticed the value getting passed to the db no problem. I then ran a test in IE to see if the value of the image variable would even get passed on the same page to the confirmation notice and it did not in IE. I tried it in the other browsers and they had no problems with it. I have no idea what it could be and thats what brought me to this forum. I tried posting on php-forum.com but they have been slow to respond. Any help out there would be greatly appreciated. I've got a temp work around in place but I don't want check boxes underneath each image.

  • #6
    Regular Coder
    Join Date
    Jul 2005
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what code are you using to catch the submit on your form action page ?
    IE (and I thought ff as well?) does not submit the name of the image as expected ... ($_POST['moveup'])

    it submits
    $_POST['moveup.x'] and $_POST['moveup.y']
    (the co-ordinates of the mouseclick)
    which PHP turns into
    $_POST['moveup_x'] and $_POST['moveup_y']

    so your PHP needs to check for..

    PHP Code:
    <?php
    if(!empty($_POST['moveup_x])){
    //form was submitted
    }
    ?>
    __________________
    Is what fire said in another post (replied to mine) this worked! Hope it helps you

  • #7
    New Coder
    Join Date
    Feb 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    P.S. I'm not looking for the x or y coordinates on an image input field. I'm using the input>type>image as the submission button for the form. There are 8 images each with a value of a president. The values are not getting passed for whatever reason from the input>type>image but are able to get passed from the input>type>checkbox.

  • #8
    New Coder
    Join Date
    Feb 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here is the code for one of the image input fields (- the ") :
    <input type=\"image\" name=\"president\" value=\"george_washington\" src=\"images/george_washington.gif\" onclick=\"MM_validateForm('email','','RisEmail');return document.MM_returnValue\" />

    The quote marks are because its in a php script. Anyway the php script (after the form is submitted) take the values from the form input fields and inserts them into a db. So far all the information is captured using IE except for the <input type=image value=somePresident name=president>.

  • #9
    New to the CF scene
    Join Date
    Jul 2008
    Location
    Oslo, Norway
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer solution

    Hi
    I had the same problem, but came up with a solution using a little onclick script:

    Code:
    <form method="post">
        <input type="hidden" name="select" value="" />
        <input type="image" name="submit" value="somePresident" src="president.gif" onclick="this.form.select.value = this.value" />
    </form>
    with this you can add as many input images you like. (I do this with a for-loop in my php-script, so they all get the same name, but that does not really matter..)
    When you click an image the value YOU have set for THAT image is transfered to the hidden input-field before the form is submitted.

    This gives the following post: select=somePresident&submit.x=37&submit.y=23

    Then you can test the $_POST['select'] variable instead of the $_POST['submit'] (which IE does not give you)

    I know that this solution kind of makes the use of image inputs pointless, but as long as there are IE-users it is probably the best solution.
    IE probably thinks that image-inputs is only ment for image-maps or something...

  • #10
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,151
    Thanks
    2
    Thanked 335 Times in 327 Posts
    I'm not looking for the x or y coordinates on an image input field
    We know that is not what you are doing, but the posts in this thread were telling you how an image as a submit button works and how you need to detect this in the php code so that it works in all browsers (the browsers where your existing code works are actually not following the standards this time). Read this (basically says what jeromepelletier posted) - http://www.php.net/manual/en/faq.htm...tml.form-image
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #11
    New to the CF scene
    Join Date
    Jul 2008
    Location
    Oslo, Norway
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    Quote Originally Posted by CFMaBiSmAd View Post
    (the browsers where your existing code works are actually not following the standards this time). Read this (basically says what jeromepelletier posted) - http://www.php.net/manual/en/faq.htm...tml.form-image
    I hate to be pedantic, but this is not entirely correct..
    what php.net says is true for php's part, but they do not set the standards for HTML. they can merely tell you how php will interpret the http-request.

    the world wide web consortium (W3C) says this about input elements:
    http://www.w3.org/TR/html401/interac...tml#edef-INPUT

    value = cdata [CA]
    This attribute specifies the initial value of the control. It is optional except when the type attribute has the value "radio" or "checkbox".
    from this I gather that IE is the standard-breaker as it does not pass the optional value attribute which the HTML-standard offers.
    All browsers (i think) including IE passes the x and y coords, but that is a different attribute than the value.

  • #12
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,151
    Thanks
    2
    Thanked 335 Times in 327 Posts
    Getting picky, but the specification supports what IE is doing. The value="..." parameter is only the initial value. When the the form is submitted the name of the control is paired with its' current value. In the case of an image, its' current value is the click coordinates -

    image
    Creates a graphical submit button. The value of the src attribute specifies the URI of the image that will decorate the button. For accessibility reasons, authors should provide alternate text for the image via the alt attribute.
    When a pointing device is used to click on the image, the form is submitted and the click coordinates passed to the server. The x value is measured in pixels from the left of the image, and the y value in pixels from the top of the image. The submitted data includes name.x=x-value and name.y=y-value where "name" is the value of the name attribute, and x-value and y-value are the x and y coordinate values, respectively.
    Strictly following what the specification states about what is submitted for successful controls, you can expect name.x and name.y to be sent for an image.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #13
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Handling type="image" input

    We attempt to avoid use of Java where possible (thinnest client & all that); I struggled with this issue for an invoice form that has multiple submit points:
    name/value=account -> populate with the customer's info
    name/value=update -> update the current line item
    name/value=edit -> go back and edit an existing line item
    name/value=delete -> delete the line item

    These are in addtion to the standard submit and cancel buttons for the invoice as a whole. I'm handling the input this way:

    switch (true) {
    case array_key_exists('account_x', $_POST) :
    // retrieve customer info and populate fields
    case array_key_exists('edit_x', $_POST) :
    // go to the requested line item
    case array_key_exists('update_x', $_POST) :
    // update the current line item
    }
    after suitably cleaning the $_POST variable, of course.

    M.

  • #14
    New to the CF scene
    Join Date
    Jan 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    This is a good solution

    if(isset($_POST[NewContent_x]))
    $Button = "1";
    if(isset($_POST[EditContent_x]))
    $Button = "2";

    NOW you know which button was hit.

  • #15
    New to the CF scene
    Join Date
    Jan 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Solution

    I had the same problem and an easy solution is to use a normal submit button with your image as background

    i used:

    <input type='submit' name='go_search' value='yes' style='border: 0px solid #FFFFFF; background-color:#E0ECF8; background-image: url(images/ico_search_29x32.gif); height: 32px; width: 29px;' alt='Rechercher'>
    my image size is 29X32 px and I used background-color:#E0ECF8 because it's the background of my page.


    It works with IE and mozila.
    with php:
    echo $_POST['go_search' ];==> yes


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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