Jump to content

[SOLVED] Input type="image" issue with IE


dartfrogs

Recommended Posts

Okay I have searched and searched for a good alternative to the problem with IE using images as a submit button. (took me a while to find out this was an iusse)

 

What I have and works great in FF is:

 

function Getflags()
{
    $res = sql_select_country();       
    $cid = $_POST['flag'];   
    $flags = '<form action="display.php" method="post"><table>';   
    
    while($resultset = @mysql_fetch_array($res)) 
    {
    $id = $resultset['id']; 
    $country = $resultset['country_name'];
    $flag = $resultset['flag_image'];
    
    $flags .='
    <tr>
    <td>'. $country .'</td>

//submit button returns $id fine with $_POST in FF not IE!!!
    <td><input type="image" src="'. $flag .'" name="flag" value="'.$id.'" /></td><td></td>
    </tr> ';
    //$i += 1; 
    }
    $flags .=' </table></form>';
   mysql_free_result($res);

    return $flags;
                  
}

 

So my question is without using hidden fields, or image coords. what is a good alternative solution?  ???

 

Help

Link to comment
Share on other sites

function Getflags()
{
    $res = sql_select_country();       
    $cid = $_POST['flag'];   
    $flags = '<form name="form" action="display.php" method="post"><table>';   
    
    while($resultset = @mysql_fetch_array($res)) 
    {
    $id = $resultset['id']; 
    $country = $resultset['country_name'];
    $flag = $resultset['flag_image'];
    
    $flags .='
    <tr>
    <td>'. $country .'</td>

//submit button returns $id fine with $_POST in FF not IE!!!
    <td><input type="image" src="'. $flag .'" onclick="document.form.submit();" name="flag" value="'.$id.'" /></td><td></td>
    </tr> ';
    //$i += 1; 
    }
    $flags .=' </table></form>';
   mysql_free_result($res);

    return $flags;
                  
}

added form name

added onclick to image

Link to comment
Share on other sites

I'm the in same boat..

you can try a standard image inside a hyperlink with border set to 0..

(could use a javascript to set a field and then submit)

or standard a html form button.

 

it was a real pain

 

anyway i thats all i have and i hope that helps

Link to comment
Share on other sites

Hey thank you I got it figured out and got things working.

 

What I had to do was go this route:

 

function Getflags()
{
    $res = sql_select_country();       
    $cid = $_GET['cid'];   
    $flags = '<form action="display.php" name="form" method="post"><table>';   
    
    while($resultset = @mysql_fetch_array($res)) 
    {
    $id = $resultset['id']; 
    $country = $resultset['country_name'];
    $flag = $resultset['flag_image'];
    
    $flags .='
    <tr>
    <td>'. $country .'</td>
    <td><a href="display.php?cid='.$id.'"><img src="'. $flag .'" name="flag"" border="0"></a></td> 
    <td></td>
    </tr> ';
    //$i += 1; 
    }
    $flags .=' </table></form>';
   mysql_free_result($res);

    return $flags;
                  
}

 

The right value is passed through and so far it works in both IE and FF. Thanks for the help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.