Rebelrebellious Posted June 10, 2008 Share Posted June 10, 2008 I am getting strange results using <input type="image" name="page" value="'.$pagetype.'" alt="'.$pagetype.'" /> Rather than getting a $_POST['page'] variable I am getting these _POST values: page_x = 40 page_y = 4 Can someone straighten me out or point me to some good reading so that I know how to use this better? Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/ Share on other sites More sharing options...
DarkWater Posted June 10, 2008 Share Posted June 10, 2008 Why is it type="image" and why does it have an alt attribute? *Bewildered* Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/#findComment-562583 Share on other sites More sharing options...
Rebelrebellious Posted June 10, 2008 Author Share Posted June 10, 2008 I am shooting for buttons that are images, since I don't have the images yet I didn't include a src="" Alt allows me to identfy the button while the image is not yet there. Maybe I am going about this the wrong way. Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/#findComment-562588 Share on other sites More sharing options...
DarkWater Posted June 10, 2008 Share Posted June 10, 2008 Form tags can't have image as their type. At least as far as I know. O_O Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/#findComment-562592 Share on other sites More sharing options...
Rebelrebellious Posted June 10, 2008 Author Share Posted June 10, 2008 Thanks for your input. How do you go about creating a custom button? Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/#findComment-562598 Share on other sites More sharing options...
DarkWater Posted June 10, 2008 Share Posted June 10, 2008 For like, a submit button? Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/#findComment-562599 Share on other sites More sharing options...
Rebelrebellious Posted June 10, 2008 Author Share Posted June 10, 2008 Yes. I thought it was possibe becaue of what I read at this site: http://www.w3schools.com/TAGS/tag_input.asp and also in other locations that I have lost track of. Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/#findComment-562601 Share on other sites More sharing options...
DarkWater Posted June 10, 2008 Share Posted June 10, 2008 Okay, I lied. =P It is possible, but you need to define a src. Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/#findComment-562602 Share on other sites More sharing options...
trq Posted June 10, 2008 Share Posted June 10, 2008 Of course an input element can have an image as its type. The resulting $_POST variables contain the x and y access of where exactly you clicked on the image. Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/#findComment-562603 Share on other sites More sharing options...
Rebelrebellious Posted June 10, 2008 Author Share Posted June 10, 2008 So how can I get the value?... I apologize if it just a matter of putting in a src since I havn't done that yet, and will be momentarily. Regards. Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/#findComment-562604 Share on other sites More sharing options...
DarkWater Posted June 10, 2008 Share Posted June 10, 2008 So how can I get the value?... I apologize if it just a matter of putting in a src since I havn't done that yet, and will be momentarily. Regards. Since you apparently can't get the value, just make a hidden input with the value. Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/#findComment-562607 Share on other sites More sharing options...
Rebelrebellious Posted June 10, 2008 Author Share Posted June 10, 2008 I was hoping to use these buttons for navigation. Different buttons cause different data to load on the page. If I use a hidden value then I will need to make a seperate form for each button or I will need to consider another option. Can anyone suggest a more streamlined alternative? Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/#findComment-562612 Share on other sites More sharing options...
DarkWater Posted June 10, 2008 Share Posted June 10, 2008 Oh, sure. Don't use forms at all and just make buttons that link to yourpage.php?section=whatever, then use $_GET on yourpage.php. Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/#findComment-562615 Share on other sites More sharing options...
Rebelrebellious Posted June 10, 2008 Author Share Posted June 10, 2008 Good point. I may just do that. Any other suggestions are still welcome. Thanks guys. Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/#findComment-562617 Share on other sites More sharing options...
Rebelrebellious Posted June 10, 2008 Author Share Posted June 10, 2008 By the way. In case anyone is wondering, I added an image source and the post name / value were still not returned. I also removed the multiple inputs with the same name and tried it just on a hunch that that may have been the problem. No change. So input type=image is really just for image maps as far as I can tell. Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/#findComment-562619 Share on other sites More sharing options...
AndyB Posted June 10, 2008 Share Posted June 10, 2008 I am getting strange results using <input type="image" name="page" value="'.$pagetype.'" alt="'.$pagetype.'" /> Rather than getting a $_POST['page'] variable I am getting these _POST values: page_x = 40 page_y = 4 Can someone straighten me out or point me to some good reading so that I know how to use this better? That's exactly how an 'image submit' is supposed to work. It's the same as image maps where you NEED to know the point that was clicked. For reference, the x and y coordinates are the pixel values of the point clicked measured form the top left corner of the image. The 'use this better' has zero application with a form submit image since wherever you click it the form submits. The 'use this better' is the entire application if you have an image map. Does that help? Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/#findComment-562621 Share on other sites More sharing options...
Rebelrebellious Posted June 10, 2008 Author Share Posted June 10, 2008 Sounds about right. Link to comment https://forums.phpfreaks.com/topic/109651-solved-image-buttons/#findComment-562632 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.