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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:17:14+00:00 2026-06-01T06:17:14+00:00

I have a form I’ve built in PHP and storing the form field values

  • 0

I have a form I’ve built in PHP and storing the form field values upon submission by the user in a MySQL database. The form is extremely long and may change periodically. So I used the json_encode functionality to store all the form values into the database. Now I need pull that info out of the database and print it out in the key/value relationship.

So for example, in the database, here’s the row named “json_payload” with some example values in this format:

{"last_name":"Smith","first_name":"John","middle_name":"Doe"..."phone_number":"111.222.3333"}

I need to figure out how to loop through this row in the database and print out all the key/value relationships with PHP in a table format so the above example would end up looking like so:

<table>
<tr>
<td>Last Name</td>
<td>Smith</td>
</tr>
<tr>
<td>First Name</td>
<td>John</td>
</tr>
<tr>
<td>Middle Name</td>
<td>Doe</td>
</tr>
...
<tr>
<td>Phone Number</td>
<td>111.222.3333</td>
</tr>
</table>
  • 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-01T06:17:15+00:00Added an answer on June 1, 2026 at 6:17 am

    JSON is normally used for Javascript/AJAX; in PHP, it’s preferred to use serialize() and unserialize(). But JSON will still work; just decode with json_decode() and loop through the array, outputting your markup:

    $json_array = json_decode($json_string, true); // decode as array rather than object
    
    echo '<table>';
    foreach($json_array as $key => $value)
    {
        echo '<tr>';
        echo '<td>'.ucfirst(str_replace('_', ' ', $key)).'</td>';
        echo '<td>'.$value.'</td>';
        echo '</tr>';
    }
    echo '</table>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have form where user submits field. Field can have letters, numbers, and punctuation.
I have form data that I insert into a database when the user clicks
I have form with checkboxes loaded from database (I use entity field type). Checkboxes
I have form who validate user input, I use PHP, Javascript and AJAX. I
I have form with user defined filters ( combobox with column names, combobox with
I currently have form that checks if a user has unsubmitted changes when they
I have form and form text field which generates dynamically using JSP. And I'm
I have form with two buttons having same name but different values ,how to
I have form which is built like this: <%= form_for @location do |f| %>
I have form, where user selects Airport and then can select one of airport

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.