SunQuest
           PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
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  
Old September 3rd, 2002, 03:28 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
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!

Reply With Quote
  #2  
Old September 3rd, 2002, 03:32 PM
bmhm bmhm is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 51 bmhm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 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>

Reply With Quote
  #3  
Old September 3rd, 2002, 03:35 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Get value from image button when clicked?

Thank you very much!

Reply With Quote
  #4  
Old September 3rd, 2002, 03:47 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
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.


Reply With Quote
  #5  
Old September 3rd, 2002, 04:08 PM
Nimco Nimco is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 132 Nimco User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Nimco
RE: RE: Get value from image button when clicked?


Quote:
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.


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.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Get value from image button when clicked?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway