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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:43:37+00:00 2026-05-15T14:43:37+00:00

i have a form which inserts book information into the database. however it is

  • 0

i have a form which inserts book information into the database. however it is not reading the $_POST attribute.

book.php:

  <form action="books_manage.php" id="addbook_form" method="post">

     <div id="ab_wrapper">

         <div id="ab_leftcolumn">
                 <div id="bookinfo">
                 <fieldset>
                     <legend>Book Details</legend>
                         <div class="field">
                             <label>Book ID</label>
                             <input type="text" name="bid" id="bid"/>
                         </div>
                         <div class="field">
                             <label>Name</label>
                             <input type="text" name="bname" id="bname"/>
                         </div>
                          <div class="field">
                             <label>Author</label>
                             <input type="text" name="bauthor" id="bauthor"/>
                         </div>
                          <div class="field">
                             <label>Info</label>
                             <textarea name="binfo" id="binfo" cols="5" rows="5" ></textarea>
                         </div>
                         <div class="field">
                             <label>Date Added</label>
                             <input type="text" value="<?php echo date('D d M Y')?>" name="bdateadd" id="bdateadd"/>
                         </div>
                         <div class="field">
                             <label>Date Updated</label>
                             <input type="text" value="<?php echo date("D d M Y")?>" name="bdateupd" id="bdateupd"/>
                         </div>
                        <div>
                         <input type="hidden" name="action" value="save">
                         <input type="submit" value="Save">
                         <input type="button" id="addcontent" value="Add Content">
                         <input type="reset" value="Reset">
                        </div>
                 </fieldset>
                 </div>
         </div>

         <div id="ab_rightcolumn">
                <div id="bookcontents">
                <fieldset>
                     <legend>Book Content</legend>
                         <div class="field">
                             <label>Chapter</label>
                             <input type="text" id="bchapter" name="bchapter"/>
                         </div>
                         <div class="field">
                             <label>Sub-Chapter</label>
                             <input type="text" id="bsubchapter" name="bsubchapter"/>
                         </div>
                          <div class="field">
                             <label>Content</label>
                             <textarea id="bcontent" name="bcontent" rows="6" cols="8"></textarea>
                         </div>
                      <br />
                         <div>
                         <input type="hidden" name="action" value="addnext">
                         <input type="submit" value="Save and Add Next Chapter">
                         <input type="submit" name="action" value="Done">
                      </div>

                 </fieldset>
             </div>

         </div>

     </div>



  </form>

books_manage.php:

<?php
  if (isset($_POST['action']) && $_POST['action'] == 'save')
    {
         echo "You clicked the save button";
    }
  else {
    echo "Hello. The date is " .  date("D d M Y") ;

  }

?>

the output:

Hello. The date is Thu 08 Jul 2010

it seems it isn’t reading the value of the hidden button. it should display “You clicked the save button”. Am I missing something?

  • 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-15T14:43:37+00:00Added an answer on May 15, 2026 at 2:43 pm

    First of all, multiple <input>s in the same <form> with the same name attribute isn’t going to get you the behavior you’re looking for.

    Instead, you need to provide a name to the submit buttons, and then you can check which button was pressed:

    <input type="submit" name="save" value="Add Content">
    <input type="submit" name="done" value="No more content">
    
    <?php
    if(isset($_POST['save'])) {
        echo "saved";
    } else if(isset($_POST['done'])) {
        echo "done";
    }
    ?>
    

    See comment below by Lèse majesté to learn how the HTML working group effed this one up.

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

Sidebar

Ask A Question

Stats

  • Questions 458k
  • Answers 458k
  • 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 Sure. Was gonna point you to Prism's implementation, but CodePlex… May 15, 2026 at 10:58 pm
  • Editorial Team
    Editorial Team added an answer docs for io module with open(fname, 'rb') as fh: first… May 15, 2026 at 10:58 pm
  • Editorial Team
    Editorial Team added an answer You might be using the wrong function - popen() is… May 15, 2026 at 10:58 pm

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.