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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:50:09+00:00 2026-06-11T05:50:09+00:00

I am creating a page that will read, write, and modify data in a

  • 0

I am creating a page that will read, write, and modify data in a mysql database. I am using php with codeigniter to perform the queries however the page that the user will see I am powering with javascript, dynamically filling and changing the data based on the user selections. To do this I am passing lots of data back and forth from php to javascript functions and vice versa, but I am wondering if there is a better way of formatting the data. For example here is a javascript function that uses XMLHttpRequest to call a php function and get the result:

var myarray = new Array(2);
myarray[0] = document.getElementById("my_input").value;
myarray[1] = document.getElementById("my_select").value;
xmlhttp.open("POST", "my_url/my_function/"+myarray.join('|'), false);
xmlhttp.send();
document.getElementById("my_element").innerHTML=xmlhttp.responseText;

I simply do an explode() on the string passed to the php function and execute the necessary queries. This seems like a very awkward interaction between php and javascript. Is there a better, or at least different, way to do this?

  • 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-11T05:50:11+00:00Added an answer on June 11, 2026 at 5:50 am

    JSON (JavaScript Object Notation) seems to be what you are looking for. You can turn pretty much all kind of Javascript variables into a string using JSON.stringify and later recover the original structure in php using json_decode, and viceversa using json_encode and JSON.parse.

    See:

    • PHP documentation on JSON
    • MDN Javascript documentation on JSON
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am creating a page that will display multiple images from the database... i
I'm creating a WP theme that will have two sections midway down the page.
I'm creating a product page that requires the price to update when the quantity
I am creating a jQuery Mobile page that has two select menu's, one is
I'm creating an asp.net page that uses the google map api. The page loads
I am creating one asp page. In that page i defined one property like
I have a document that my asp.net page is creating and I need to
I'm creating a website that will have the admin upload documents available only to
I'm creating a web page, when opened in iphone safari browser, a cookie will
I'm creating a plugin/bookmarklet that will take an XML document embedded within the <textarea>

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.