Jump to content

image buttons on IE6


crouchjay

Recommended Posts

I am using an image for a button but when calling

if(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.
Link to comment
https://forums.phpfreaks.com/topic/8884-image-buttons-on-ie6/
Share on other sites

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.
Link to comment
https://forums.phpfreaks.com/topic/8884-image-buttons-on-ie6/#findComment-32602
Share on other sites

[!--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.
Link to comment
https://forums.phpfreaks.com/topic/8884-image-buttons-on-ie6/#findComment-32605
Share on other sites

[!--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.
Link to comment
https://forums.phpfreaks.com/topic/8884-image-buttons-on-ie6/#findComment-32626
Share on other sites

[!--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.
Link to comment
https://forums.phpfreaks.com/topic/8884-image-buttons-on-ie6/#findComment-32668
Share on other sites

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>

<?php
if(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]
Link to comment
https://forums.phpfreaks.com/topic/8884-image-buttons-on-ie6/#findComment-32672
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.