Jump to content


Photo

image buttons on IE6


  • Please log in to reply
6 replies to this topic

#1 crouchjay

crouchjay
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 02 May 2006 - 12:39 PM

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.

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 02 May 2006 - 01:34 PM

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.
Legend has it that reading the manual never killed anyone.
My site

#3 crouchjay

crouchjay
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 02 May 2006 - 02:03 PM

[!--quoteo(post=370542:date=May 2 2006, 03:34 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ May 2 2006, 03:34 PM) View Post[/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.


#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 02 May 2006 - 02:52 PM

[!--quoteo(post=370546:date=May 2 2006, 10:03 AM:name=crouchjay)--][div class=\'quotetop\']QUOTE(crouchjay @ May 2 2006, 10:03 AM) View Post[/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.

Legend has it that reading the manual never killed anyone.
My site

#5 crouchjay

crouchjay
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 02 May 2006 - 05:05 PM

[!--quoteo(post=370567:date=May 2 2006, 04:52 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ May 2 2006, 04:52 PM) View Post[/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.

#6 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 02 May 2006 - 05:24 PM

Remember that the name for the image buttons gets stuff appended in the POST array. Try this:
<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/>";
}

?>

Legend has it that reading the manual never killed anyone.
My site

#7 crouchjay

crouchjay
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 02 May 2006 - 09:08 PM

Thank you so much, that works




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users