Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 790535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:41:53+00:00 2026-05-14T21:41:53+00:00

I have a problem in creating a Button with text and image on it.

  • 0

I have a problem in creating a Button with text and image on it.

<td> 

<button type="submit" name="report" value="Report"  
<?php 
 if($tab == 'Excel') 
   echo "id=\"tab_inactive\""; 
 else 
   echo "id=\"tab_active\"" ; ?>>
 <img src="images/report.gif" alt="Report"/>Report
</button>

<button type="submit" name="excel" value="Excel"  
<?php 
 if($tab == 'Excel' )
     echo "id=\"tab_active\""; 
 else 
     echo "id=\"tab_inactive\"" ; ?>>
<img src="images/Excel.gif" alt="Excel" width="16" height="16" /> Excel
</button>

</td>

Here $tab is

$tab = strlen(trim($_POST[excel]))>0 ? $_POST[excel] : $_POST[report];

I tried this way, but this is behaving so strangely.
On click the button:- The submit function is working properly in firefox, but not in IE.

Instead of submitting the value(in this example values are ‘Report’ and ‘Excel’), indeed it is submitting the label of the button.

That is if i am checking the value of array PRINT_R($_POST). The value of it is

Array ( [report] =>(Icon that i used) Report 
        [excel] => (Icon that i used) Excel 
        [frm_analysis] => [to_analysis] => ) 

Here i have more than 1 button, then all the labels are submitted eventhough one of them is pressed. i dont how to capture which button is pressed.

I even tried changing button type=button and onclick="document.formname.submit()" Even this is resulting in the same.

Can you please help me to solve this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:41:54+00:00Added an answer on May 14, 2026 at 9:41 pm

    <button>s are broken in IE. I think they corrected it in IE7 or 8. Is the page in standards mode? That may help in IE7 or 8.

    If you need to support the broken version, you could try and work around it with JS, if you don’t mind being dependent on it. Example:

    <script type="text/javascript">
      function buttonclicked(button) {
        button.form.elements["buttonclicked"].value = this.value;
      }
    </script>
    
    <input type="hidden" name="buttonclicked" value="">
    <button type="submit" name="report" onclick="buttonclicked(this)">
     <img src="images/report.gif" alt="Report"/>Report
    </button>
    <button type="submit" name="excel" onclick="buttonclicked(this)">
    <img src="images/Excel.gif" alt="Excel" width="16" height="16" /> Excel
    </button>
    

    I don’t think there is any other way other than avoiding <button> and using <input type=submit> if you need to distinguish between which on was clicked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 394k
  • Answers 394k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The program will crash as you have it since you're… May 15, 2026 at 2:29 am
  • Editorial Team
    Editorial Team added an answer In your controller @hash = [your hash code] In your… May 15, 2026 at 2:29 am
  • Editorial Team
    Editorial Team added an answer Use a java.util.Scanner and java.util.List. Scanner sc = new Scanner(new… May 15, 2026 at 2:29 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.