SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict Fire59's Avatar
    Join Date
    Aug 2003
    Location
    mn
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    input type=image

    PHP Code:
    <input name="priceOption" type="image" id="priceOption"  value="4" src="/images/order.gif" border="0" alt="Order" title="Order"
    I do a print_r($_POST) and the priceOption value shows up in the array except when i'm in IE.

    Has anyone found a work around for this?

  2. #2
    SEO Addict eli03's Avatar
    Join Date
    Aug 2004
    Location
    Pasig City Cainta, Philippines
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    there's no reason why this code not work on ie

  3. #3
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ie don't send image's name if you submit the form by hitting enter in input box.

  4. #4
    SitePoint Addict Fire59's Avatar
    Join Date
    Aug 2003
    Location
    mn
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not trying to get an image name. Just the variable priceOption and value. Go ahead and paste the code it will not show up in ie.

  5. #5
    SitePoint Addict Fire59's Avatar
    Join Date
    Aug 2003
    Location
    mn
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I made a simple test script:
    PHP Code:
    <?php
    print_r
    ($_POST);
    echo 
    '<form method="post" action="'.$_SERVER[PHP_SELF].'" >'
    echo 
    '<input name="priceOption" type="image" id="priceOption"  value="4" src="/images/order.gif" border="0" alt="Order" title="Order">';
    echo 
    '</form>';
    ?>
    Result in Firefox:
    PHP Code:
    Array
    (
        [
    priceOption_x] => 21
        
    [priceOption_y] => 8
        
    [priceOption] => 4

    Result in IE
    PHP Code:
    Array
    (
        [
    priceOption_x] => 14
        
    [priceOption_y] => 3

    priceOption doesn't show up in IE.

  6. #6
    SitePoint Addict Fire59's Avatar
    Join Date
    Aug 2003
    Location
    mn
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    help, anyone?

  7. #7
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyway, input type=image is treated differently is mozilla/ie, so it's good reason not to rely on it. If you need a form with mutiple image submits, give them unique names

    <input type=image name=priceOption1>
    <input type=image name=priceOption2>
    <input type=image name=priceOption3> etc

    In form processing logic check if one of those exists:

    priceOption1
    priceOption1_x
    priceOption1.x

  8. #8
    SitePoint Addict Fire59's Avatar
    Join Date
    Aug 2003
    Location
    mn
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's what i ended up doing and stripping the x out to use as my value. I hate IE.

  9. #9
    SitePoint Member AlexBrina's Avatar
    Join Date
    Jul 2004
    Location
    office.bh.mg.br
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    quote from W3C

    "
    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".
    "
    I don't like IE either, but in this case...
    Alex Brina
    "...sempre q eu tirar a cabeça fora d'agua eu dou um alô..." JC


Bookmarks

Posting Permissions

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