for ex

    <?php esc_html_e('Simple Category', LEARNDASH_WPPROQUIZ_TEXT_DOMAIN); ?>
    <input class="small-text" id="cate1" type="text" name="showCat1QuestionValue" >
    <?php esc_html_e('Medium Category', LEARNDASH_WPPROQUIZ_TEXT_DOMAIN); ?>
    input class="small-text" id="cate2" type="text" name="showMaxQuestionValue" value="">
    <?php esc_html_e('Hard Category', LEARNDASH_WPPROQUIZ_TEXT_DOMAIN); ?>
    <input class="small-text" id="cate3" type="text" name="showMaxQuestionValue" value="">

can u help me?

  • 1
    Which table?? Are you using form to submit or js ? You need to make your question clear. May 6 '18 at 15:50

Though you haven't mention the process and WP tables to insert textbox values in existing WP table. Either you can used option table or postmeta table for your purpose.

  1. For option: WordPress provides two specification API functions for writing data to the database. One comes in the form of adding information, one comes in the form of updating information.

    • add_option
      1. A key - or a unique identifier for the information
      2. The value of the data to be stored

As per your sample form

if ( isset( $_POST['showCat1QuestionValue'] ) && ! empty( $_POST['showCat1QuestionValue'] ) {
    add_option( 'cate1', $_POST['showCat1QuestionValue'] );
  • update_option

    1. Add the option if it doesn't already exists
    2. Overwrite the existing value if it does exist

2.For Post meta:
Post meta API functions take in three piece of information:

  1. The post ID
  2. The data key
  3. The data value

Sample code

global $post;

add_post_meta( $post->ID, 'cate1', 'showCat1QuestionValue');

Have a look for metabox in more details:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.