473,385 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Image button doesn't work

250 100+
I have a image button in php. But it doesn't work. This is my code

Expand|Select|Wrap|Line Numbers
  1. <form method="post" action="user.php">
  2. <input name="Remove" src="../images/Remove.jpg"  type="image" />
  3.  
  4. if(isset($_POST['Remove'])){
  5.  
  6.     echo "remove";
  7. }    
  8.  
  9. </form>                
  10.  
  11.  
Aug 12 '09 #1

✓ answered by zorgi

Oups

There is this solution to this IE bug without using javascript:

Expand|Select|Wrap|Line Numbers
  1. <form method="post" action="">
  2.  
  3. <button type="submit" name="Remove" style="border: 0; background: transparent; cursor: pointer;">
  4.     <img src="../images/Remove.jpg"  />
  5. </button>
  6.  
  7. <?php
  8. if(isset($_POST['Remove'])){
  9.     echo "remove";
  10. }    
  11. ?> 
  12. </form>   
  13.  
  14.  

7 3679
Dormilich
8,658 Expert Mod 8TB
what does not work?

.....
Aug 12 '09 #2
ghjk
250 100+
When I click remove button I want to
Expand|Select|Wrap|Line Numbers
  1. echo "Remove";
. But nothing append and page refresh only
Aug 12 '09 #3
zorgi
431 Expert 256MB
Expand|Select|Wrap|Line Numbers
  1. <form method="post" action="user.php">
  2. <input name="Remove" value="remove" src="../images/Remove.jpg"  type="image" />
  3. <?php
  4.  
  5. if(isset($_POST['Remove'])){
  6.  
  7.     echo "remove";
  8. }    
  9. ?> 
  10. </form>   
  11.  
This works... I only added: value="remove" for your button and <?php ?>
Aug 12 '09 #4
ghjk
250 100+
Thnx. But it doesn't work on IE. I'm using IE. Please help me..
Aug 12 '09 #5
Markus
6,050 Expert 4TB
It won't do anything because you're not submitting the form...

Expand|Select|Wrap|Line Numbers
  1. <form id="myform" method="post" action="">
  2.     <input type="image" src="../path/to/img.jpg" name="Remove" onclick="document.getElementById('myform').submit();" />
  3.  
  4. <?php if (isset($_POST['Remove'])) echo "remove"; ?>
  5.  
  6. </form>
Not sure if the javascript's right (dormilich?) - also, not sure it a type=image input acts as a submit button (making the javascript pointless).
Aug 12 '09 #6
zorgi
431 Expert 256MB
Oups

There is this solution to this IE bug without using javascript:

Expand|Select|Wrap|Line Numbers
  1. <form method="post" action="">
  2.  
  3. <button type="submit" name="Remove" style="border: 0; background: transparent; cursor: pointer;">
  4.     <img src="../images/Remove.jpg"  />
  5. </button>
  6.  
  7. <?php
  8. if(isset($_POST['Remove'])){
  9.     echo "remove";
  10. }    
  11. ?> 
  12. </form>   
  13.  
  14.  
Aug 12 '09 #7
ghjk
250 100+
Thnk you all. zorgi 's code is working..
Aug 13 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Csaba2000 | last post by:
I want to be able to programatically click on the center of an <INPUT type=image ...> element (I only care about IE 5.5+). This should work regardless of whether IE has focus. Normally you would...
2
by: Matt | last post by:
In the following code, I have 2 questions regarding submit button with image. 1) Does this code <input type="image" name="populate" src="populate.gif"> behave the same as an HTML submit button...
15
by: Anand Ganesh | last post by:
HI All, I have an Image. I want to clip a portion of it and copy to another image. How to do this? I know the bounding rectangle to clip. Any suggestions please. Thanks for your time and...
2
by: Mark Kamoski | last post by:
How can one change an image url at runtime? (Note, the image exists in a user control.) This is the image tag on the ascx... <asp:image id="TopBanner" runat="server"></asp:image> ....but...
3
by: Alberto | last post by:
I'm trying to load an image in a PictureBox but I want the PictureBox has always the same size and if the image is bigger, show a scrollBars. How can I do it? Thank you
6
by: WJ | last post by:
Is there a way to specify background image for an Aspx page at runtime in c# ? I clicked on the Web form in the IDE (Vs.Net 2003) and it shows "DOCUMENT", which is not accessible inside code behind...
3
by: lofty00 | last post by:
hello, sorry about the repost - I've been posting to several groups and I've decided it's better to make a single repost to all of them rather than an extra post in each. I've been trying to...
4
by: John Smith | last post by:
I have a continuous form. there is a command button with the following code for the OnClick event: DoCmd.OpenForm "frmPlants", , , "PlantsID =" & Me!PlantsID I click the button and frmPlants...
16
by: browntown | last post by:
so I have this application I'm nearly finished with. The only thing the client has requested is the ability to submit the form by pressing "enter". I didn't think this would be a huge pain in the...
2
by: smokeyd | last post by:
i am trying to create a simple image button rollover.. i have searched this forum and found a number of solutions but none seem to work. i am just trying to get the onmouseover to swap the image...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.