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
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
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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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