crouchjay Posted May 2, 2006 Share Posted May 2, 2006 I am using an image for a button but when callingif(isset($_POST['delete.x=x-value']))I know that the values that are passed are x 0-50 and y 0-10, but that is the image dimensions. How do I make x several values instead of hoping the user clicks on the right pixel? Should the x and y values be different form the image? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/8884-image-buttons-on-ie6/ Share on other sites More sharing options...
AndyB Posted May 2, 2006 Share Posted May 2, 2006 The x and y values will always be the coordinates of where the user clicked the image reative to its upper-left corner. You can't change that! You can't expect a user to click the correct pixel.You can't get "several" values with one click.Explain what you're trying to do and we'll help. Quote Link to comment https://forums.phpfreaks.com/topic/8884-image-buttons-on-ie6/#findComment-32602 Share on other sites More sharing options...
crouchjay Posted May 2, 2006 Author Share Posted May 2, 2006 [!--quoteo(post=370542:date=May 2 2006, 03:34 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ May 2 2006, 03:34 PM) [snapback]370542[/snapback][/div][div class=\'quotemain\'][!--quotec--]The x and y values will always be the coordinates of where the user clicked the image reative to its upper-left corner. You can't change that! You can't expect a user to click the correct pixel.You can't get "several" values with one click.Explain what you're trying to do and we'll help.[/quote]Instead of using regular submit buttons I want to use images, but I have 2 things that needs to happen, one is either delete selected items or add selected items. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/8884-image-buttons-on-ie6/#findComment-32605 Share on other sites More sharing options...
AndyB Posted May 2, 2006 Share Posted May 2, 2006 [!--quoteo(post=370546:date=May 2 2006, 10:03 AM:name=crouchjay)--][div class=\'quotetop\']QUOTE(crouchjay @ May 2 2006, 10:03 AM) [snapback]370546[/snapback][/div][div class=\'quotemain\'][!--quotec--]Instead of using regular submit buttons I want to use images, but I have 2 things that needs to happen, one is either delete selected items or add selected items. Thanks.[/quote]OK, so who cares about the x and y values? Surely these are separate images - one for delete and the other for add and they have different names so you can tell which was clicked. Quote Link to comment https://forums.phpfreaks.com/topic/8884-image-buttons-on-ie6/#findComment-32626 Share on other sites More sharing options...
crouchjay Posted May 2, 2006 Author Share Posted May 2, 2006 [!--quoteo(post=370567:date=May 2 2006, 04:52 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ May 2 2006, 04:52 PM) [snapback]370567[/snapback][/div][div class=\'quotemain\'][!--quotec--]OK, so who cares about the x and y values? Surely these are separate images - one for delete and the other for add and they have different names so you can tell which was clicked.[/quote]<form action="test3.php" method="post" ><input type="checkbox" name="languages[]" value="csharp" />C# <br /><input type="checkbox" name="languages[]" value="jscript" />jscript <br /><input type="checkbox" name="languages[]" value="perl" />perl <br /><input type="checkbox" name="languages[]" value="php" />php <br /><input name="delete" type="image" src="images/delete_btn.gif"/><input name="submit" type="image" src="images/send_btn.gif"/></form>if(isset($_POST['submit'])) {echo "You chose the following languages. <br/>";foreach($_POST['languages'] AS $language) echo "$language<br/>";}if(isset($_POST['delete'])) {echo "has been deleted. <br/>";foreach($_POST['languages'] AS $language) echo "$language<br/>";}echo "hello";this is my code that I am testing with, but nothing happens accept that it prints hello any time I press either. Quote Link to comment https://forums.phpfreaks.com/topic/8884-image-buttons-on-ie6/#findComment-32668 Share on other sites More sharing options...
AndyB Posted May 2, 2006 Share Posted May 2, 2006 Remember that the name for the image buttons gets stuff appended in the POST array. Try this:[code]<form action="#" method="post" ><input type="checkbox" name="languages[]" value="csharp" />C# <br /><input type="checkbox" name="languages[]" value="jscript" />jscript <br /><input type="checkbox" name="languages[]" value="perl" />perl <br /><input type="checkbox" name="languages[]" value="php" />php <br /><input name="delete" type="image" src="images/delete_btn.gif"/><input name="submit" type="image" src="images/send_btn.gif"/></form><?phpif(isset($_POST['submit_x'])) { echo "You chose the following languages. <br/>"; foreach($_POST['languages'] AS $language) echo "$language<br/>";}if(isset($_POST['delete_x'])) { echo "has been deleted. <br/>"; foreach($_POST['languages'] AS $language) echo "$language<br/>";}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/8884-image-buttons-on-ie6/#findComment-32672 Share on other sites More sharing options...
crouchjay Posted May 2, 2006 Author Share Posted May 2, 2006 Thank you so much, that works Quote Link to comment https://forums.phpfreaks.com/topic/8884-image-buttons-on-ie6/#findComment-32764 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.