Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

input type = image

  • 11-11-2009 12:00am
    #1
    Registered Users, Registered Users 2 Posts: 35,524 ✭✭✭✭


    I'm trying to figure out why one of my little websites isn't working on certain browsers/OSs. I think it's Vista that it's not working on, but I can replicate it on Lynx text browser.

    It's just an image submit (there's a few image submits) that passes variables to another php file.
    <html>
    <body>
    
    <form action="process.php" method="post"> 
    <input type="image" name="vote" src="image.gif" value="vote" />
    </form>
    
    </body>
    </html>
    

    (process.php)
    <html>
    <body>
    
    <?php
    $vote = $_POST['vote'];
    echo "Vote = " . $vote;
    ?>
    
    </body>
    </html>
    

    Normal circumstances this should output 'Vote = Vote' but in Lynx it doesn't because it doesn't seem to pass the variable through the POST, if that makes any sense. Normally I'd consider the fact that you can't use the image input like this, but it works ok on Firefox Mac, and Safari.

    Any ideas?


Comments

  • Registered Users, Registered Users 2 Posts: 21,257 ✭✭✭✭Eoin


    So the page is submitting, but the value of the image isn't being passed through?

    I remember years ago having to do Request.Form("imgSubmit.x") in ASP, but I can't quite remember what the problem was - it might have been something similar. If you're stuck, you could also try using a normal input button, but using CSS to set the background image.


  • Registered Users, Registered Users 2 Posts: 35,524 ✭✭✭✭Gordon


    eoin wrote: »
    So the page is submitting, but the value of the image isn't being passed through?
    Aye
    I remember years ago having to do Request.Form("imgSubmit.x") in ASP, but I can't quite remember what the problem was - it might have been something similar. If you're stuck, you could also try using a normal input button, but using CSS to set the background image.
    I read somewhere about images using two values but I didn't understand it, I'll look into that again properly, ta. I remember dabbling with input buttons and not being able to use css well with the bg image, but maybe I'm just losing it. Will do!


  • Registered Users, Registered Users 2 Posts: 21,257 ✭✭✭✭Eoin


    Maybe it's to do with the xy coordinates of where the image was clicked, I'm not too sure.


  • Registered Users, Registered Users 2 Posts: 35,524 ✭✭✭✭Gordon


    Looked into it more and apparently browsers will post the value of an image input along with onclick x and y coordinates. But IE just sends x and y coordinates of the onclick. :/

    /shakes fist at IE again


  • Registered Users, Registered Users 2 Posts: 21,257 ✭✭✭✭Eoin


    Gordon wrote: »
    Looked into it more and apparently browsers will post the value of an image input along with onclick x and y coordinates. But IE just sends x and y coordinates of the onclick. :/

    /shakes fist at IE again

    That's a bit of a pain, but I suppose once you name each image input differently, you don't really need a value.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 35,524 ✭✭✭✭Gordon


    Yeah, that was a bit of a pain, but some good learning to be had! Cheers for the look in. Can you do me a favour if you are on IE and give the cakey link in my sig a couple of clicks and see if the votes cast ok for you? It's working in IE (hopefully) and lynx now which is cool, I didn't think lynx would like image inputs.


  • Registered Users, Registered Users 2 Posts: 21,257 ✭✭✭✭Eoin


    Yeah, they all seemed to work fine in IE8. I will test in earlier versions tomorrow.


  • Registered Users, Registered Users 2 Posts: 35,524 ✭✭✭✭Gordon


    No probs, I'm sure it works fine. Cheers for that eoin!


  • Registered Users, Registered Users 2 Posts: 21,257 ✭✭✭✭Eoin


    Gordon wrote: »
    No probs, I'm sure it works fine. Cheers for that eoin!

    Just tested it in a program that renders IE 5.5, 6, 7 and 8 and they all seem fine.


Advertisement