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

  • Home
  • SEARCH
  • 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 8577387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:08:54+00:00 2026-06-11T20:08:54+00:00

I am now using jquery .submit action (form) to POST the data. A normal

  • 0

I am now using jquery .submit action (form) to POST the data. A normal POST operation in JAVA does not pass label/value key. For the following (sample) form how I do that ?. I do not want to use Ajax as my form would have upload file fields too and I know how to handle that only in simple POST operation.

<body>
     <form id="frmRequest" name="frmRequest" >

                <div class="clearfix" id="idRequestDetails"  >
                    <table width="809" border="0" id="tbl_data_1_1_1_1__" summary="Profile">
                      <tr>
                        <th width="156" scope="col"><label class="labelrequest" for="txtProfileName1__">Name</label>
                        </th>
                        <th width="74" scope="col"><label class="labelrequest" for="txtProfileUserID1__">User ID</label></th>
                        <th width="131" scope="col"><label class="labelrequest" for="txtSiteCost1__">Site Cost Centre</label></th>
                         <th width="182" scope="col"><label class="labelrequest" for="txtDetail1__">Additional Details</label></th>
                      </tr>
                      <tr>
                        <td><input type="text" name="txtProfileName1__" id="txtProfileName1__" tabindex="100" /></td>
                        <td><input name="txtProfileUserID1__" type="text" class="clearfix" id="txtProfileUserID1__" tabindex="110" size="8" /></td>
                        <td><input name="txtSiteCost1__" type="text" id="txtSiteCost1__" tabindex="220" size="8" /></td>

                        <td><textarea name="txtDetail1__" rows="1" id="txtDetail1__" tabindex="240"></textarea></td>
                      </tr>
                    </table>
                  </div>
        </body>

Tried the following but not working

foreach ($_POST  as $key => $value)
{
   if($key === 'labels') {
      // Decode JSON string to array
      $value = json_decode($value, true);
   }
   if (!is_array($value))
   {
      $message .= "<br/>".$key." : ".$value;
   }
   else
   {
      foreach ($value as $itemvalue)
      {
         $message .= "<br/>".$value." : ".$itemvalue;
      }
   }
} 
  • 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-11T20:08:55+00:00Added an answer on June 11, 2026 at 8:08 pm

    You have to build inputs with information you need before form is sent.

    Here is sample where I find text between LABEL tags.
    Create hidden INPUT.
    Set INPUT’s name.
    Set INPUT’s value which is JSON encoded array of label values

    $("form").submit(function(event) {
       $labels = $(this).find("label");
       $ret = [];
       $.each($labels, function() {
           $ret.push($(this).text());
       });
       $input = $("<input>").attr("type", "hidden").attr("name", "labels").val(JSON.stringify($ret));
       $(this).append($input);
    });
    

    Since I put all labels into JSON object, in foreach loop, before first if, you need to find labels data, decode it to array

    Like this:

    foreach ($_POST  as $key => $value)
    {
       if($key === 'labels') {
          // Decode JSON string to array
          $value = json_decode($value, true);
       }
       if (!is_array($value))
       {
          $message .= "<br/>".$key." : ".$value;
       }
       else
       {
          foreach ($value as $itemvalue)
          {
             $message .= "<br/>".$value." : ".$itemvalue;
          }
       }
    } 
    

    Just in case check out JSON functions and your PHP version

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

Sidebar

Related Questions

With ASP.NET MVC3 I'm using Jquery/Ajax to post data from a form to a
I'm making a form submit with jQuery's AJAX. I'm having several form's using AJAX
In the following code, I'm using Ajax.BeginForm to post data to the action asynchronously.
I have form where before i was using simple post with <button name=submit id=register
I already have a form with normal HTTP post. Now, I want to rewrite
I am using JQuery Validation . Now I want my rules to be invoked
I've been using JQuery masonry and now I'm adding infinite scroll. There are images
I am using JQuery with the DataTable plugin, and now I have a big
i m using jQuery tablsorter plugin, it's working perfect,but now problem is ... i
I am using Jquery Ui plugins jquery-1.3.2.min.js and jquery-ui-1.7.1.custom.min.js and now i want to

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.