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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:12:54+00:00 2026-05-18T08:12:54+00:00

We have 5 inputs ( type=text ) on html page /edit_person.php : <input id=name

  • 0

We have 5 inputs (type="text") on html page /edit_person.php:

<input id="name" name="name" value="" />
<input id="surname" name="surname" value="" />
<input id="age" name="age" value="" />
<input id="begin" name="begin" value="" />
<input id="end" name="end" value="" />

And a php file /scripts/db.php

If we open in browser /scripts/db.php?get=1 it will give something like (an array with values):

$data = Array(
[name]=>Mark,
[surname]=>Twain,
[age]=>74,
[begin]=>November 30, 1835,
[end]=>April 21, 1910
)

How can we request /scripts/db.php?get=1 by ajax on /edit_person.php and insert received data to the inputs?

jQuery last version is used and PHP 5.2.

If input currently has some value, it should be replaced.

Output format of db.php can be changed, you can request options which would be better.

Thanks.

  • 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-18T08:12:55+00:00Added an answer on May 18, 2026 at 8:12 am

    db.php seems to be outputting the array in some custom, PHP-like format. I wouldn’t do that. Use json_encode() instead: jQuery’s Ajax can handle JSON data natively.

    • Docs on jQuery.getJSON() with examples

    • If your JSON data is in a variable named data, the insertion into each input will be a simple $("#name").val(data.name);

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

Sidebar

Related Questions

I have this input text: <html><head><meta http-equiv=content-type content=text/html; charset=utf-8></head><body><table cellspacing=0 cellpadding=0 border=0 align=center width=603>
I have to do an HTML page with 2 text boxes, one for name
I have the following html button <td><form id=form2 name=form2 method=post onclick=../cgi-bin/py/GuestBookEntry.py> <input type=submit name=gBookSrib
I have an input field on my page where the user will type in
I have a form on a page where the user has inputs to edit
We have some input data that sometimes appears with &nbsp characters on the end.
I have saved input from a textarea element to a TEXT column in MySQL.
can use anything in any order? does placing of <meta http-equiv=Content-Type content=text/html;charset=UTF-8> is important
I have a html page which requires two passwords, if these do not match
I have some dynamically created inputs which are not server-side controls. 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.