|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Get value from image button when clicked?
// 1. How to make the image name became variable when it is clicked in php?
echo("<IMG SRC="arrow1.gif" NAME="trade" >"); // 2. I can use isset($_POST['trade']) function to know the button has been clicked when the input type is "submit", and can get value by $_POST['trade']. But how to let php page know whether the image button has been clicked, and how to get value in the following 2 cases? // use input element, but the type is image echo("<input type="image" src="arrow1.gif" name="trade" value="".$symbol"">"); // use button element echo("<button name="trade" value="".$symbol."" type="button">trade <img src="arrow1.gif"></button>"); Thanks! |
|
#2
|
|||
|
|||
|
RE: Get value from image button when clicked?
Just add a variable on the end of the images href link. So if you have an image called "home.gif" you would put something to the effect of this
<a href="index.php?image=home"><img src="images/home.gif" border="0"></a> |
|
#3
|
|||
|
|||
|
RE: Get value from image button when clicked?
Thank you very much!
|
|
#4
|
|||
|
|||
|
RE: Get value from image button when clicked?
If I use text or image link, i can use Anchor, but how to make a link to the <input type="button"> or <Button>, I can't use Anchor to it.
|
|
#5
|
|||
|
|||
|
RE: RE: Get value from image button when clicked?
Quote:
If you need only do it with a single image, use the submit button as the image. Otherwise you can use JavaScript to set the value of a hidden field when the button is clicked. Alternatively, you could use checkboxes. How many images does this need to be applied to? The problem with using buttons to pass variables is that the user cannot tell whether the button is selected or not - i.e. when using checkboxes, it has a checked state and an unchecked state, push buttons do not. |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Get value from image button when clicked? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|