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 8395411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:17:38+00:00 2026-06-09T20:17:38+00:00

Currently, I have an HTML form where the user will enter a title and

  • 0

Currently, I have an HTML form where the user will enter a title and text for an article. When it is time to submit, they are presented with two buttons. One is to ‘save’ their article without publishing it, and the other is to ‘publish’ the article and make it public.

I’m using PHP, and I am trying to figure out how to tell which button was used, in order to store the appropriate corresponding value in the database.

<td>
<input type="submit" class="noborder" id="save" value="" alt="Save" tabindex="4" />
</td>
<td>
<input type="submit" class="noborder" id="publish" value="" alt="Publish" tabindex="5" />
</td>

Probably should have mentioned this earlier, but I cannot assign the buttons values because the button is an image, so the text would show up above it.

  • 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-06-09T20:17:40+00:00Added an answer on June 9, 2026 at 8:17 pm

    Give each input a name attribute. Only the clicked input‘s name attribute will be sent to the server.

    <input type="submit" name="publish" value="Publish">
    <input type="submit" name="save" value="Save">
    

    And then

    <?php
        if (isset($_POST['publish'])) {
            # Publish-button was clicked
        }
        elseif (isset($_POST['save'])) {
            # Save-button was clicked
        }
    ?>
    

    Edit: Changed value attributes to alt. Not sure this is the best approach for image buttons though, any particular reason you don’t want to use input[type=image]?

    Edit: Since this keeps getting upvotes I went ahead and changed the weird alt/value code to real submit inputs. I believe the original question asked for some sort of image buttons but there are so much better ways to achieve that nowadays instead of using input[type=image].

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

Sidebar

Related Questions

Currently I have an HTML form with a hidden field right before a text
I currently have two apps: app1/ app2/ templates/ app1.html app2.html In app1.html, I'm including
I have the following HTML. Currently it relies on the user hitting the 'Go'
I am hooking into Html Form submissions where the submit buttons have a specific
Currently I'm working on a textbook ordering html form with PHP User shown a
Okay so say I have a form element like this: HTML: <div class=form-item> <label>Current
I currently have a huge HTML file which doesn't have line breaks and just
I currently have the following CSS (called splash.css): html { background:url(splash.jpg) center no-repeat; background-size:auto
I currently have the following MySQL statement to replace the HTML entity for a
I currently have a product view page that contains an MVCContrib HTML Grid with

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.