jwhite68 Posted May 30, 2007 Share Posted May 30, 2007 I am trying to achieve something very simple (I think), but hitting hurdles with HTML code. My current code: form method = "GET" action="http://abc.test.com/register" > <input type="image" name= "val" value="foobar" src="elements/epayments.gif" style="width:168px" > </form> And the idea is that when I click the (image) button, I want it to invoke: http://abc.test.com/register?val=foorbar. Can anyone help? Quote Link to comment https://forums.phpfreaks.com/topic/53570-help-with-format-of-html-get-and-input-type-image/ Share on other sites More sharing options...
pocobueno1388 Posted May 30, 2007 Share Posted May 30, 2007 <form method = "GET" action="http://abc.test.com/register?val=foobar" > <input type="image" name= "val" value="foobar" src="elements/epayments.gif" style="width:168px" > </form> You have to put it in the form action =] Quote Link to comment https://forums.phpfreaks.com/topic/53570-help-with-format-of-html-get-and-input-type-image/#findComment-264751 Share on other sites More sharing options...
jwhite68 Posted May 30, 2007 Author Share Posted May 30, 2007 It doesnt work when I do that. It outputs as: https://abc.test.com/register?val.x=88&val.y=18 As if its taking the co-ordinates of the image. Quote Link to comment https://forums.phpfreaks.com/topic/53570-help-with-format-of-html-get-and-input-type-image/#findComment-264758 Share on other sites More sharing options...
pocobueno1388 Posted May 30, 2007 Share Posted May 30, 2007 Oops, you have to change your form method to "post"...not "get". Quote Link to comment https://forums.phpfreaks.com/topic/53570-help-with-format-of-html-get-and-input-type-image/#findComment-264779 Share on other sites More sharing options...
jwhite68 Posted May 30, 2007 Author Share Posted May 30, 2007 I specifically have to use 'GET' for what I am doing. Isnt there a way to achieve it with GET? Quote Link to comment https://forums.phpfreaks.com/topic/53570-help-with-format-of-html-get-and-input-type-image/#findComment-264781 Share on other sites More sharing options...
pocobueno1388 Posted May 30, 2007 Share Posted May 30, 2007 What exactly are you doing? You can still get the values from the URL using <?php $val = $_GET['val']; ?> Are you worried you won't be able to do that anymore? Quote Link to comment https://forums.phpfreaks.com/topic/53570-help-with-format-of-html-get-and-input-type-image/#findComment-264786 Share on other sites More sharing options...
jwhite68 Posted May 30, 2007 Author Share Posted May 30, 2007 No. I am passing the data to a payment gateway, who have specifically said that I have to use GET, and not POST. Quote Link to comment https://forums.phpfreaks.com/topic/53570-help-with-format-of-html-get-and-input-type-image/#findComment-264791 Share on other sites More sharing options...
pocobueno1388 Posted May 30, 2007 Share Posted May 30, 2007 Hmmm, sorry...I'm not too sure how to get the URL to format correctly using the get method instead =/ Quote Link to comment https://forums.phpfreaks.com/topic/53570-help-with-format-of-html-get-and-input-type-image/#findComment-264800 Share on other sites More sharing options...
pocobueno1388 Posted May 30, 2007 Share Posted May 30, 2007 I think it's because you have an image as the input type. I just tried putting a submit button, and everything worked out fine with the URL. If you did keep the image, the payment gateway should still be able to get the value of "val" from the URL. Quote Link to comment https://forums.phpfreaks.com/topic/53570-help-with-format-of-html-get-and-input-type-image/#findComment-264807 Share on other sites More sharing options...
jwhite68 Posted May 30, 2007 Author Share Posted May 30, 2007 I just sent it to the payment gateway via POST, and it seems fine anyway. Thanks for the advice. Quote Link to comment https://forums.phpfreaks.com/topic/53570-help-with-format-of-html-get-and-input-type-image/#findComment-264871 Share on other sites More sharing options...
pocobueno1388 Posted May 30, 2007 Share Posted May 30, 2007 Don't forget to press "solved" in the bottom left corner =] Quote Link to comment https://forums.phpfreaks.com/topic/53570-help-with-format-of-html-get-and-input-type-image/#findComment-264883 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.